Compare commits

..

1 Commits

Author SHA1 Message Date
KimLS 296d48993e Convert zone points from old style linked list to std 2022-02-14 00:53:56 -08:00
288 changed files with 1724 additions and 28368 deletions
-116
View File
@@ -1,116 +0,0 @@
{
//"testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*"
"testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/**/*zone{test,Test,TEST}*",
"cmake.configureSettings": {
//"EQEMU_BUILD_SERVER": "ON",
"EQEMU_BUILD_LUA": "ON"
},
"files.associations": {
"chrono": "cpp",
"functional": "cpp",
"algorithm": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"execution": "cpp",
"resumable": "cpp",
"filesystem": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"scoped_allocator": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"source_location": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"strstream": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"valarray": "cpp",
"variant": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"*.tcc": "cpp",
"string_view": "cpp",
"rope": "cpp",
"slist": "cpp",
"*.ipp": "cpp"
}
}
+1 -2
View File
@@ -127,7 +127,7 @@ OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build zone tests." ON)
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)
@@ -442,7 +442,6 @@ ENDIF(EQEMU_BUILD_HC)
IF(EQEMU_BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(test)
ENDIF(EQEMU_BUILD_TESTS)
IF(EQEMU_BUILD_CLIENT_FILES)
-45
View File
@@ -22,7 +22,6 @@
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
@@ -140,50 +139,6 @@ bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
return false;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == false) {
return true;
}
}
return false;
}
bool WorldContentService::DoesPassContentFiltering(const ContentFlags &f)
{
// if we're not set to (-1 All) then fail when we aren't within minimum expansion
if (f.min_expansion > Expansion::EXPANSION_ALL && current_expansion < f.min_expansion) {
return false;
}
// if we're not set to (-1 All) then fail when we aren't within max expansion
if (f.max_expansion > Expansion::EXPANSION_ALL && current_expansion > f.max_expansion) {
return false;
}
// if we don't have any enabled flag in enabled flags, we fail
for (const auto& flag: SplitString(f.content_flags)) {
if (!contains(GetContentFlagsEnabled(), flag)) {
return false;
}
}
// if we don't have any disabled flag in disabled flags, we fail
for (const auto& flag: SplitString(f.content_flags_disabled)) {
if (!contains(GetContentFlagsDisabled(), flag)) {
return false;
}
}
return true;
}
void WorldContentService::ReloadContentFlags()
{
std::vector<ContentFlagsRepository::ContentFlags> set_content_flags;
-4
View File
@@ -23,7 +23,6 @@
#include <string>
#include <vector>
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
class Database;
@@ -166,13 +165,10 @@ public:
std::vector<std::string> GetContentFlagsEnabled();
std::vector<std::string> GetContentFlagsDisabled();
bool IsContentFlagEnabled(const std::string& content_flag);
bool IsContentFlagDisabled(const std::string& content_flag);
void SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags);
void ReloadContentFlags();
WorldContentService * SetExpansionContext();
bool DoesPassContentFiltering(const ContentFlags& f);
WorldContentService * SetDatabase(Database *database);
Database *GetDatabase() const;
+1 -13
View File
@@ -997,18 +997,6 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
return true;
}
void Database::SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum)
{
QueryDatabase(
fmt::format(
"UPDATE `account` SET `{}` = '{}' WHERE `id` = {}",
field_name,
checksum,
account_id
)
);
}
// Get zone starting points from DB
bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
@@ -2297,7 +2285,7 @@ void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
auto row = results.begin();
exemption_id = atoi(row[0]);
}
query = fmt::format(
"INSERT INTO `ip_exemptions` (`exemption_ip`, `exemption_amount`) VALUES ('{}', {})",
account_ip,
-2
View File
@@ -190,8 +190,6 @@ public:
int16 CheckStatus(uint32 account_id);
void SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum);
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
-1
View File
@@ -558,7 +558,6 @@ N(OP_WhoAllRequest),
N(OP_WhoAllResponse),
N(OP_World_Client_CRC1),
N(OP_World_Client_CRC2),
N(OP_World_Client_CRC3),
N(OP_WorldClientReady),
N(OP_WorldComplete),
N(OP_WorldLogout),
-5
View File
@@ -5582,11 +5582,6 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct Checksum_Struct {
uint64 checksum;
uint8 data[2048];
};
struct UpdateMovementEntry {
/* 00 */ float Y;
/* 04 */ float X;
+18 -20
View File
@@ -116,24 +116,22 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
/**
* Set Defaults
*/
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
/**
* RFC 5424
@@ -243,7 +241,7 @@ void EQEmuLogSys::ProcessGMSay(
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone ||
EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld
) {
) {
on_log_gmsay_hook(log_category, message);
}
}
@@ -469,7 +467,7 @@ void EQEmuLogSys::Out(
std::string prefix;
if (RuleB(Logging, PrintFileFunctionAndLine)) {
prefix = fmt::format("[{0}:{1}] ", base_file_name(file), line);
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
}
va_list args;
-2
View File
@@ -127,7 +127,6 @@ namespace Logs {
DiaWind,
HTTP,
Saylink,
ChecksumVerification,
MaxCategoryID /* Don't Remove this */
};
@@ -213,7 +212,6 @@ namespace Logs {
"DialogueWindow",
"HTTP",
"Saylink",
"ChecksumVerification",
};
}
-22
View File
@@ -696,16 +696,6 @@
OutF(LogSys, Logs::Detail, Logs::Saylink, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogChecksumVerification(message, ...) do {\
if (LogSys.log_settings[Logs::ChecksumVerification].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::ChecksumVerification, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogChecksumVerificationDetail(message, ...) do {\
if (LogSys.log_settings[Logs::ChecksumVerification].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::ChecksumVerification, __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__);\
@@ -1102,18 +1092,6 @@
#define LogHTTPDetail(message, ...) do {\
} while (0)
#define LogSaylink(message, ...) do {\
} while (0)
#define LogSaylinkDetail(message, ...) do {\
} while (0)
#define LogChecksumVerification(message, ...) do {\
} while (0)
#define LogChecksumVerificationDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
+5 -14
View File
@@ -30,19 +30,11 @@ struct LootTableEntries_Struct {
float probability;
};
struct ContentFlags {
int16 min_expansion;
int16 max_expansion;
char content_flags[100];
char content_flags_disabled[100];
};
struct LootTable_Struct {
uint32 mincash;
uint32 maxcash;
uint32 avgcoin;
uint32 NumEntries;
ContentFlags content_flags;
uint32 mincash;
uint32 maxcash;
uint32 avgcoin;
uint32 NumEntries;
LootTableEntries_Struct Entries[0];
};
@@ -59,8 +51,7 @@ struct LootDropEntries_Struct {
};
struct LootDrop_Struct {
uint32 NumEntries;
ContentFlags content_flags;
uint32 NumEntries;
LootDropEntries_Struct Entries[0];
};
#pragma pack()
-5
View File
@@ -5218,11 +5218,6 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct Checksum_Struct {
uint64_t checksum;
uint8_t data[2048];
};
}; /*structs*/
}; /*RoF2*/
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaAbilityRepository {
public:
@@ -60,36 +59,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_ability");
@@ -99,7 +73,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRankEffectsRepository {
public:
@@ -42,27 +41,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"rank_id",
"slot",
"effect_id",
"base1",
"base2",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_rank_effects");
@@ -72,7 +55,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRankPrereqsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"rank_id",
"aa_id",
"points",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_rank_prereqs");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRanksRepository {
public:
@@ -58,35 +57,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_ranks");
@@ -96,7 +71,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountFlagsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"p_accid",
"p_flag",
"p_value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_flags");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountIpRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"accid",
"ip",
"count",
"lastused",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_ip");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -90,7 +74,7 @@ public:
entry.accid = 0;
entry.ip = "";
entry.count = 1;
entry.lastused = std::time(nullptr);
entry.lastused = "";
return entry;
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountRepository {
public:
@@ -33,14 +32,11 @@ public:
std::string minilogin_ip;
int hideme;
int rulesflag;
time_t suspendeduntil;
std::string suspendeduntil;
int time_creation;
int expansion;
std::string ban_reason;
std::string suspend_reason;
std::string crc_eqgame;
std::string crc_skillcaps;
std::string crc_basedata;
};
static std::string PrimaryKey()
@@ -70,37 +66,6 @@ public:
"expansion",
"ban_reason",
"suspend_reason",
"crc_eqgame",
"crc_skillcaps",
"crc_basedata",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"charname",
"sharedplat",
"password",
"status",
"ls_id",
"lsaccount_id",
"gmspeed",
"revoked",
"karma",
"minilogin_ip",
"hideme",
"rulesflag",
"UNIX_TIMESTAMP(suspendeduntil)",
"time_creation",
"expansion",
"ban_reason",
"suspend_reason",
"crc_eqgame",
"crc_skillcaps",
"crc_basedata",
};
}
@@ -109,11 +74,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account");
@@ -123,7 +83,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -155,14 +115,11 @@ public:
entry.minilogin_ip = "";
entry.hideme = 0;
entry.rulesflag = 0;
entry.suspendeduntil = 0;
entry.suspendeduntil = "0000-00-00 00:00:00";
entry.time_creation = 0;
entry.expansion = 0;
entry.ban_reason = "";
entry.suspend_reason = "";
entry.crc_eqgame = "";
entry.crc_skillcaps = "";
entry.crc_basedata = "";
return entry;
}
@@ -212,14 +169,11 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
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] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
return entry;
}
@@ -266,14 +220,11 @@ public:
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] + " = FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
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) + "'");
update_values.push_back(columns[19] + " = '" + EscapeString(account_entry.crc_eqgame) + "'");
update_values.push_back(columns[20] + " = '" + EscapeString(account_entry.crc_skillcaps) + "'");
update_values.push_back(columns[21] + " = '" + EscapeString(account_entry.crc_basedata) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -309,14 +260,11 @@ public:
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("FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
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_values.push_back("'" + EscapeString(account_entry.crc_eqgame) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_skillcaps) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_basedata) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -360,14 +308,11 @@ public:
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("FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
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_values.push_back("'" + EscapeString(account_entry.crc_eqgame) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_skillcaps) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_basedata) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -415,14 +360,11 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
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] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
all_entries.push_back(entry);
}
@@ -461,14 +403,11 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
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] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
all_entries.push_back(entry);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountRewardsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"account_id",
"reward_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_rewards");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureDetailsRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_details");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureMembersRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_members");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureStatsRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_stats");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateEntryFlavorRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"text",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry_flavor");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateEntryRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"template_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateRepository {
public:
@@ -98,55 +97,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template");
@@ -156,7 +111,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -193,7 +148,7 @@ public:
entry.zone_in_time = 1800;
entry.win_points = 0;
entry.lose_points = 0;
entry.theme = 1;
entry.theme = LDoNThemes::GUK;
entry.zone_in_zone_id = 0;
entry.zone_in_x = 0;
entry.zone_in_y = 0;
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAlternateCurrencyRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"item_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("alternate_currency");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAurasRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("auras");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBaseDataRepository {
public:
@@ -52,32 +51,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("base_data");
@@ -87,7 +65,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBlockedSpellsRepository {
public:
@@ -56,34 +55,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("blocked_spells");
@@ -93,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -1,326 +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_BOOKS_REPOSITORY_H
#define EQEMU_BASE_BOOKS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBooksRepository {
public:
struct Books {
int id;
std::string name;
std::string txtfile;
int language;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"txtfile",
"language",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"txtfile",
"language",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("books");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Books NewEntity()
{
Books entry{};
entry.id = 0;
entry.name = "";
entry.txtfile = "";
entry.language = 0;
return entry;
}
static Books GetBooksEntry(
const std::vector<Books> &bookss,
int books_id
)
{
for (auto &books : bookss) {
if (books.id == books_id) {
return books;
}
}
return NewEntity();
}
static Books FindOne(
Database& db,
int books_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
books_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = atoi(row[3]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int books_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
books_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Books books_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(books_entry.name) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(books_entry.txtfile) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(books_entry.language));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
books_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Books InsertOne(
Database& db,
Books books_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(books_entry.id));
insert_values.push_back("'" + EscapeString(books_entry.name) + "'");
insert_values.push_back("'" + EscapeString(books_entry.txtfile) + "'");
insert_values.push_back(std::to_string(books_entry.language));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
books_entry.id = results.LastInsertedID();
return books_entry;
}
books_entry = NewEntity();
return books_entry;
}
static int InsertMany(
Database& db,
std::vector<Books> books_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &books_entry: books_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(books_entry.id));
insert_values.push_back("'" + EscapeString(books_entry.name) + "'");
insert_values.push_back("'" + EscapeString(books_entry.txtfile) + "'");
insert_values.push_back(std::to_string(books_entry.language));
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<Books> All(Database& db)
{
std::vector<Books> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Books> GetWhere(Database& db, std::string where_filter)
{
std::vector<Books> 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) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = 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_BOOKS_REPOSITORY_H
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBugReportsRepository {
public:
@@ -46,9 +45,9 @@ public:
int _unknown_value;
std::string bug_report;
std::string system_info;
time_t report_datetime;
std::string report_datetime;
int bug_status;
time_t last_review;
std::string last_review;
std::string last_reviewer;
std::string reviewer_notes;
};
@@ -96,54 +95,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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",
"UNIX_TIMESTAMP(report_datetime)",
"bug_status",
"UNIX_TIMESTAMP(last_review)",
"last_reviewer",
"reviewer_notes",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("bug_reports");
@@ -153,7 +109,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -198,9 +154,9 @@ public:
entry._unknown_value = 0;
entry.bug_report = "";
entry.system_info = "";
entry.report_datetime = std::time(nullptr);
entry.report_datetime = "";
entry.bug_status = 0;
entry.last_review = std::time(nullptr);
entry.last_review = "";
entry.last_reviewer = "None";
entry.reviewer_notes = "";
@@ -265,9 +221,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -329,9 +285,9 @@ public:
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] + " = FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
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] + " = FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
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) + "'");
@@ -382,9 +338,9 @@ public:
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("FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
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("FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
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) + "'");
@@ -443,9 +399,9 @@ public:
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("FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
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("FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
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) + "'");
@@ -508,9 +464,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -564,9 +520,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBugsRepository {
public:
@@ -58,35 +57,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("bugs");
@@ -96,7 +71,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBuyerRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"buyslot",
"itemid",
"itemname",
"quantity",
"price",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("buyer");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharCreateCombinationsRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"allocation_id",
"race",
"`class`",
"deity",
"start_zone",
"expansions_req",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_create_combinations");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharCreatePointAllocationsRepository {
public:
@@ -62,37 +61,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_create_point_allocations");
@@ -102,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharRecipeListRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"recipe_id",
"madecount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_recipe_list");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterActivitiesRepository {
public:
@@ -42,27 +41,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"taskid",
"activityid",
"donecount",
"completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_activities");
@@ -72,7 +55,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAltCurrencyRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"currency_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_alt_currency");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAlternateAbilitiesRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"aa_id",
"aa_value",
"charges",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_alternate_abilities");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAurasRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_auras");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBandolierRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"bandolier_id",
"bandolier_slot",
"item_id",
"icon",
"bandolier_name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_bandolier");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBindRepository {
public:
@@ -48,30 +47,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_bind");
@@ -81,7 +61,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBuffsRepository {
public:
@@ -66,39 +65,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_buffs");
@@ -108,7 +79,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCorpseItemsRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_corpse_items");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCorpsesRepository {
public:
@@ -28,7 +27,7 @@ public:
float y;
float z;
float heading;
time_t time_of_death;
std::string time_of_death;
int guild_consent_id;
int is_rezzed;
int is_buried;
@@ -126,69 +125,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
"charname",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
"UNIX_TIMESTAMP(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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_corpses");
@@ -198,7 +139,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -225,7 +166,7 @@ public:
entry.y = 0;
entry.z = 0;
entry.heading = 0;
entry.time_of_death = 0;
entry.time_of_death = "0000-00-00 00:00:00";
entry.guild_consent_id = 0;
entry.is_rezzed = 0;
entry.is_buried = 0;
@@ -307,7 +248,7 @@ public:
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 = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
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]);
@@ -386,7 +327,7 @@ public:
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] + " = FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
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));
@@ -454,7 +395,7 @@ public:
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("FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
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));
@@ -530,7 +471,7 @@ public:
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("FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
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));
@@ -610,7 +551,7 @@ public:
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 = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
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]);
@@ -681,7 +622,7 @@ public:
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 = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
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]);
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCurrencyRepository {
public:
@@ -66,39 +65,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
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 SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_currency");
@@ -108,7 +79,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterDataRepository {
public:
@@ -120,7 +119,7 @@ public:
int aa_points_spent_old;
int aa_points_old;
int e_last_invsnapshot;
time_t deleted_at;
std::string deleted_at;
};
static std::string PrimaryKey()
@@ -236,124 +235,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"account_id",
"name",
"last_name",
"title",
"suffix",
"zone_id",
"zone_instance",
"y",
"x",
"z",
"heading",
"gender",
"race",
"`class`",
"level",
"deity",
"birthday",
"last_login",
"time_played",
"level2",
"anon",
"gm",
"face",
"hair_color",
"hair_style",
"beard",
"beard_color",
"eye_color_1",
"eye_color_2",
"drakkin_heritage",
"drakkin_tattoo",
"drakkin_details",
"ability_time_seconds",
"ability_number",
"ability_time_minutes",
"ability_time_hours",
"exp",
"aa_points_spent",
"aa_exp",
"aa_points",
"group_leadership_exp",
"raid_leadership_exp",
"group_leadership_points",
"raid_leadership_points",
"points",
"cur_hp",
"mana",
"endurance",
"intoxication",
"str",
"sta",
"cha",
"dex",
"`int`",
"agi",
"wis",
"zone_change_count",
"toxicity",
"hunger_level",
"thirst_level",
"ability_up",
"ldon_points_guk",
"ldon_points_mir",
"ldon_points_mmc",
"ldon_points_ruj",
"ldon_points_tak",
"ldon_points_available",
"tribute_time_remaining",
"career_tribute_points",
"tribute_points",
"tribute_active",
"pvp_status",
"pvp_kills",
"pvp_deaths",
"pvp_current_points",
"pvp_career_points",
"pvp_best_kill_streak",
"pvp_worst_death_streak",
"pvp_current_kill_streak",
"pvp2",
"pvp_type",
"show_helm",
"group_auto_consent",
"raid_auto_consent",
"guild_auto_consent",
"leadership_exp_on",
"RestTimer",
"air_remaining",
"autosplit_enabled",
"lfp",
"lfg",
"mailkey",
"xtargets",
"firstlogon",
"e_aa_effects",
"e_percent_to_aa",
"e_expended_aa_spent",
"aa_points_spent_old",
"aa_points_old",
"e_last_invsnapshot",
"UNIX_TIMESTAMP(deleted_at)",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_data");
@@ -363,7 +249,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -482,7 +368,7 @@ public:
entry.aa_points_spent_old = 0;
entry.aa_points_old = 0;
entry.e_last_invsnapshot = 0;
entry.deleted_at = 0;
entry.deleted_at = "";
return entry;
}
@@ -619,7 +505,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
entry.deleted_at = row[101] ? row[101] : "";
return entry;
}
@@ -753,7 +639,7 @@ public:
update_values.push_back(columns[98] + " = " + std::to_string(character_data_entry.aa_points_spent_old));
update_values.push_back(columns[99] + " = " + std::to_string(character_data_entry.aa_points_old));
update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot));
update_values.push_back(columns[101] + " = FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -876,7 +762,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.aa_points_spent_old));
insert_values.push_back(std::to_string(character_data_entry.aa_points_old));
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -1007,7 +893,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.aa_points_spent_old));
insert_values.push_back(std::to_string(character_data_entry.aa_points_old));
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -1142,7 +1028,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
entry.deleted_at = row[101] ? row[101] : "";
all_entries.push_back(entry);
}
@@ -1268,7 +1154,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
entry.deleted_at = row[101] ? row[101] : "";
all_entries.push_back(entry);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterDisciplinesRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"disc_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_disciplines");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -1,327 +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_EXP_MODIFIERS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterExpModifiersRepository {
public:
struct CharacterExpModifiers {
int character_id;
int zone_id;
float aa_modifier;
float exp_modifier;
};
static std::string PrimaryKey()
{
return std::string("character_id");
}
static std::vector<std::string> Columns()
{
return {
"character_id",
"zone_id",
"aa_modifier",
"exp_modifier",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"character_id",
"zone_id",
"aa_modifier",
"exp_modifier",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_exp_modifiers");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterExpModifiers NewEntity()
{
CharacterExpModifiers entry{};
entry.character_id = 0;
entry.zone_id = 0;
entry.aa_modifier = 0;
entry.exp_modifier = 0;
return entry;
}
static CharacterExpModifiers GetCharacterExpModifiersEntry(
const std::vector<CharacterExpModifiers> &character_exp_modifierss,
int character_exp_modifiers_id
)
{
for (auto &character_exp_modifiers : character_exp_modifierss) {
if (character_exp_modifiers.character_id == character_exp_modifiers_id) {
return character_exp_modifiers;
}
}
return NewEntity();
}
static CharacterExpModifiers FindOne(
Database& db,
int character_exp_modifiers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_exp_modifiers_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(row[3]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_exp_modifiers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_exp_modifiers_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterExpModifiers character_exp_modifiers_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_exp_modifiers_entry.character_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_exp_modifiers_entry.zone_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_exp_modifiers_entry.aa_modifier));
update_values.push_back(columns[3] + " = " + std::to_string(character_exp_modifiers_entry.exp_modifier));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_exp_modifiers_entry.character_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterExpModifiers InsertOne(
Database& db,
CharacterExpModifiers character_exp_modifiers_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_exp_modifiers_entry.character_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.zone_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.aa_modifier));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.exp_modifier));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_exp_modifiers_entry.character_id = results.LastInsertedID();
return character_exp_modifiers_entry;
}
character_exp_modifiers_entry = NewEntity();
return character_exp_modifiers_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterExpModifiers> character_exp_modifiers_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_exp_modifiers_entry: character_exp_modifiers_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_exp_modifiers_entry.character_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.zone_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.aa_modifier));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.exp_modifier));
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<CharacterExpModifiers> All(Database& db)
{
std::vector<CharacterExpModifiers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(row[3]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterExpModifiers> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterExpModifiers> 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) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(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_EXP_MODIFIERS_REPOSITORY_H
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterExpeditionLockoutsRepository {
public:
@@ -23,7 +22,7 @@ public:
int character_id;
std::string expedition_name;
std::string event_name;
time_t expire_time;
std::string expire_time;
int duration;
std::string from_expedition_uuid;
};
@@ -46,29 +45,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"character_id",
"expedition_name",
"event_name",
"UNIX_TIMESTAMP(expire_time)",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_expedition_lockouts");
@@ -78,7 +59,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -100,7 +81,7 @@ public:
entry.character_id = 0;
entry.expedition_name = "";
entry.event_name = "";
entry.expire_time = std::time(nullptr);
entry.expire_time = "";
entry.duration = 0;
entry.from_expedition_uuid = "";
@@ -142,7 +123,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -181,7 +162,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_expedition_lockouts_entry.character_id));
update_values.push_back(columns[2] + " = '" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
update_values.push_back(columns[4] + " = '" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration));
update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -209,7 +190,7 @@ public:
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -245,7 +226,7 @@ public:
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -285,7 +266,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -316,7 +297,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterInspectMessagesRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"inspect_message",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_inspect_messages");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterInstanceSafereturnsRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"character_id",
"instance_zone_id",
"instance_id",
"safe_zone_id",
"safe_x",
"safe_y",
"safe_z",
"safe_heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_instance_safereturns");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterItemRecastRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"recast_type",
"timestamp",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_item_recast");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterLanguagesRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"lang_id",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_languages");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterLeadershipAbilitiesRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"rank",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_leadership_abilities");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterMaterialRepository {
public:
@@ -46,29 +45,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"blue",
"green",
"red",
"use_tint",
"color",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_material");
@@ -78,7 +59,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterMemmedSpellsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_memmed_spells");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetBuffsRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"slot",
"spell_id",
"caster_level",
"castername",
"ticsremaining",
"counters",
"numhits",
"rune",
"instrument_mod",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_buffs");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetInfoRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"petname",
"petpower",
"spell_id",
"hp",
"mana",
"size",
"taunting",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_info");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetInventoryRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"slot",
"item_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_inventory");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPotionbeltRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"potion_id",
"item_id",
"icon",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_potionbelt");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterSkillsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"skill_id",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_skills");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterSpellsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_spells");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -134,7 +134,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[4], nullptr, 10);
return entry;
}
@@ -171,7 +171,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_task_timers_entry.character_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_task_timers_entry.task_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_task_timers_entry.timer_type));
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -197,7 +197,7 @@ public:
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -231,7 +231,7 @@ public:
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -269,7 +269,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[4], nullptr, 10);
all_entries.push_back(entry);
}
@@ -298,7 +298,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[4], nullptr, 10);
all_entries.push_back(entry);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterTasksRepository {
public:
@@ -42,27 +41,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"taskid",
"slot",
"type",
"acceptedtime",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_tasks");
@@ -72,7 +55,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCompletedTasksRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"completedtime",
"taskid",
"activityid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("completed_tasks");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseContentFlagsRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"flag_name",
"enabled",
"notes",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("content_flags");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDamageshieldtypesRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"spellid",
"type",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("damageshieldtypes");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDataBucketsRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"key",
"value",
"expires",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("data_buckets");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -126,7 +110,7 @@ public:
if (results.RowCount() == 1) {
DataBuckets entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -257,7 +241,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -285,7 +269,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDbStrRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"type",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("db_str");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDiscoveredItemsRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"item_id",
"char_name",
"discovered_date",
"account_status",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("discovered_items");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDoorsRepository {
public:
@@ -102,57 +101,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"doorid",
"zone",
"version",
"name",
"pos_y",
"pos_x",
"pos_z",
"heading",
"opentype",
"guild",
"lockpick",
"keyitem",
"nokeyring",
"triggerdoor",
"triggertype",
"disable_timer",
"doorisopen",
"door_param",
"dest_zone",
"dest_instance",
"dest_x",
"dest_y",
"dest_z",
"dest_heading",
"invert_state",
"incline",
"size",
"buffer",
"client_version_mask",
"is_ldon_door",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("doors");
@@ -162,7 +115,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -211,8 +164,8 @@ public:
entry.buffer = 0;
entry.client_version_mask = 4294967295;
entry.is_ldon_door = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDynamicZoneMembersRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"dynamic_zone_id",
"character_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("dynamic_zone_members");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDynamicZonesRepository {
public:
@@ -76,44 +75,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"instance_id",
"type",
"uuid",
"name",
"leader_id",
"min_players",
"max_players",
"compass_zone_id",
"compass_x",
"compass_y",
"compass_z",
"safe_return_zone_id",
"safe_return_x",
"safe_return_y",
"safe_return_z",
"safe_return_heading",
"zone_in_x",
"zone_in_y",
"zone_in_z",
"zone_in_heading",
"has_zone_in",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("dynamic_zones");
@@ -123,7 +89,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseEventlogRepository {
public:
@@ -52,32 +51,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"accountname",
"accountid",
"status",
"charname",
"target",
"time",
"descriptiontype",
"description",
"event_nid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("eventlog");
@@ -87,7 +65,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -111,7 +89,7 @@ public:
entry.status = 0;
entry.charname = "";
entry.target = "None";
entry.time = std::time(nullptr);
entry.time = "";
entry.descriptiontype = "";
entry.description = "";
entry.event_nid = 0;
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseExpeditionLockoutsRepository {
public:
@@ -22,7 +21,7 @@ public:
int id;
int expedition_id;
std::string event_name;
time_t expire_time;
std::string expire_time;
int duration;
std::string from_expedition_uuid;
};
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"expedition_id",
"event_name",
"UNIX_TIMESTAMP(expire_time)",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("expedition_lockouts");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -96,7 +78,7 @@ public:
entry.id = 0;
entry.expedition_id = 0;
entry.event_name = "";
entry.expire_time = std::time(nullptr);
entry.expire_time = "";
entry.duration = 0;
entry.from_expedition_uuid = "";
@@ -137,7 +119,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -175,7 +157,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(expedition_lockouts_entry.expedition_id));
update_values.push_back(columns[2] + " = '" + EscapeString(expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
update_values.push_back(columns[3] + " = '" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration));
update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -202,7 +184,7 @@ public:
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -237,7 +219,7 @@ public:
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -276,7 +258,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -306,7 +288,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseExpeditionsRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"dynamic_zone_id",
"add_replay_on_join",
"is_locked",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("expeditions");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionBaseDataRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"client_faction_id",
"min",
"max",
"unk_hero1",
"unk_hero2",
"unk_hero3",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_base_data");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionListModRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"faction_id",
"mod",
"mod_name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_list_mod");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionListRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"base",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_list");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionValuesRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"faction_id",
"current_value",
"temp",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_values");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFishingRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"Itemid",
"skill_level",
"chance",
"npc_id",
"npc_chance",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("fishing");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -115,8 +92,8 @@ public:
entry.chance = 0;
entry.npc_id = 0;
entry.npc_chance = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseForageRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"Itemid",
"level",
"chance",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("forage");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -107,8 +86,8 @@ public:
entry.Itemid = 0;
entry.level = 0;
entry.chance = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFriendsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"type",
"name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("friends");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGlobalLootRepository {
public:
@@ -66,39 +65,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"description",
"loottable_id",
"enabled",
"min_level",
"max_level",
"rare",
"raid",
"race",
"`class`",
"bodytype",
"zone",
"hot_zone",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("global_loot");
@@ -108,7 +79,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -139,8 +110,8 @@ public:
entry.bodytype = "";
entry.zone = "";
entry.hot_zone = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGmIpsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"name",
"account_id",
"ip_address",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("gm_ips");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGoallistsRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"listid",
"entry",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("goallists");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGraveyardRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zone_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("graveyard");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroundSpawnsRepository {
public:
@@ -68,40 +67,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"version",
"max_x",
"max_y",
"max_z",
"min_x",
"min_y",
"heading",
"name",
"item",
"max_allowed",
"comment",
"respawn_timer",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("ground_spawns");
@@ -111,7 +81,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -143,8 +113,8 @@ public:
entry.max_allowed = 1;
entry.comment = "";
entry.respawn_timer = 300;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroupIdRepository {
public:
@@ -40,26 +39,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"groupid",
"charid",
"name",
"ismerc",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("group_id");
@@ -69,7 +53,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroupLeadersRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"gid",
"leadername",
"marknpc",
"leadershipaa",
"maintank",
"assist",
"puller",
"mentoree",
"mentor_percent",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("group_leaders");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildMembersRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"guild_id",
"rank",
"tribute_enable",
"total_tribute",
"last_tribute",
"banker",
"public_note",
"alt",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_members");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildRanksRepository {
public:
@@ -54,33 +53,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"guild_id",
"rank",
"title",
"can_hear",
"can_speak",
"can_invite",
"can_remove",
"can_promote",
"can_demote",
"can_motd",
"can_warpeace",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_ranks");
@@ -90,7 +67,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildRelationsRepository {
public:
@@ -38,25 +37,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"guild1",
"guild2",
"relation",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_relations");
@@ -66,7 +51,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildsRepository {
public:
@@ -50,31 +49,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"leader",
"minstatus",
"motd",
"tribute",
"motd_setter",
"channel",
"url",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guilds");
@@ -84,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseHackersRepository {
public:
@@ -44,28 +43,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"account",
"name",
"hacked",
"zone",
"date",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("hackers");
@@ -75,7 +57,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -98,7 +80,7 @@ public:
entry.name = "";
entry.hacked = "";
entry.zone = "";
entry.date = std::time(nullptr);
entry.date = "";
return entry;
}
@@ -1,12 +1,29 @@
/**
* DO NOT MODIFY THIS FILE
* 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
*
*
*/
/**
* 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
* 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
*/
#ifndef EQEMU_BASE_HORSES_REPOSITORY_H
@@ -14,42 +31,26 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseHorsesRepository {
public:
struct Horses {
int id;
std::string filename;
int race;
int gender;
int texture;
int16 race;
int8 gender;
int8 texture;
float mountspeed;
std::string notes;
};
static std::string PrimaryKey()
{
return std::string("id");
return std::string("filename");
}
static std::vector<std::string> Columns()
{
return {
"id",
"filename",
"race",
"gender",
"texture",
"mountspeed",
"notes",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"filename",
"race",
"gender",
@@ -64,9 +65,19 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
static std::string InsertColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
@@ -78,7 +89,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}
@@ -88,7 +99,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
InsertColumnsRaw()
);
}
@@ -96,7 +107,6 @@ public:
{
Horses entry{};
entry.id = 0;
entry.filename = "";
entry.race = 216;
entry.gender = 0;
@@ -113,7 +123,7 @@ public:
)
{
for (auto &horses : horsess) {
if (horses.id == horses_id) {
if (horses.filename == horses_id) {
return horses;
}
}
@@ -122,11 +132,10 @@ public:
}
static Horses FindOne(
Database& db,
int horses_id
)
{
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -138,13 +147,12 @@ public:
if (results.RowCount() == 1) {
Horses entry{};
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
return entry;
}
@@ -153,11 +161,10 @@ public:
}
static int DeleteOne(
Database& db,
int horses_id
)
{
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -170,7 +177,6 @@ public:
}
static int UpdateOne(
Database& db,
Horses horses_entry
)
{
@@ -178,20 +184,20 @@ public:
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(horses_entry.filename) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(horses_entry.race));
update_values.push_back(columns[3] + " = " + std::to_string(horses_entry.gender));
update_values.push_back(columns[4] + " = " + std::to_string(horses_entry.texture));
update_values.push_back(columns[5] + " = " + std::to_string(horses_entry.mountspeed));
update_values.push_back(columns[6] + " = '" + EscapeString(horses_entry.notes) + "'");
update_values.push_back(columns[0] + " = '" + EscapeString(horses_entry.filename) + "'");
update_values.push_back(columns[1] + " = " + std::to_string(horses_entry.race));
update_values.push_back(columns[2] + " = " + std::to_string(horses_entry.gender));
update_values.push_back(columns[3] + " = " + std::to_string(horses_entry.texture));
update_values.push_back(columns[4] + " = " + std::to_string(horses_entry.mountspeed));
update_values.push_back(columns[5] + " = '" + EscapeString(horses_entry.notes) + "'");
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
horses_entry.id
horses_entry.filename
)
);
@@ -199,13 +205,11 @@ public:
}
static Horses InsertOne(
Database& db,
Horses horses_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(horses_entry.id));
insert_values.push_back("'" + EscapeString(horses_entry.filename) + "'");
insert_values.push_back(std::to_string(horses_entry.race));
insert_values.push_back(std::to_string(horses_entry.gender));
@@ -213,7 +217,7 @@ public:
insert_values.push_back(std::to_string(horses_entry.mountspeed));
insert_values.push_back("'" + EscapeString(horses_entry.notes) + "'");
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -222,7 +226,7 @@ public:
);
if (results.Success()) {
horses_entry.id = results.LastInsertedID();
horses_entry.filename = results.LastInsertedID();
return horses_entry;
}
@@ -232,7 +236,6 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Horses> horses_entries
)
{
@@ -241,7 +244,6 @@ public:
for (auto &horses_entry: horses_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(horses_entry.id));
insert_values.push_back("'" + EscapeString(horses_entry.filename) + "'");
insert_values.push_back(std::to_string(horses_entry.race));
insert_values.push_back(std::to_string(horses_entry.gender));
@@ -254,7 +256,7 @@ public:
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -265,11 +267,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Horses> All(Database& db)
static std::vector<Horses> All()
{
std::vector<Horses> all_entries;
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -281,13 +283,12 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Horses entry{};
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
@@ -295,11 +296,11 @@ public:
return all_entries;
}
static std::vector<Horses> GetWhere(Database& db, std::string where_filter)
static std::vector<Horses> GetWhere(std::string where_filter)
{
std::vector<Horses> all_entries;
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -312,13 +313,12 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Horses entry{};
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
@@ -326,12 +326,13 @@ public:
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
static int DeleteWhere(std::string where_filter)
{
auto results = db.QueryDatabase(
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
PrimaryKey(),
where_filter
)
);
@@ -339,18 +340,6 @@ public:
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_HORSES_REPOSITORY_H
@@ -14,7 +14,6 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseInstanceListPlayerRepository {
public:
@@ -36,24 +35,11 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("instance_list_player");
@@ -63,7 +49,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
ColumnsRaw(),
TableName()
);
}

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