[Bug] PR 3638 Missed the blocked spells repository updates (#3748)

Ran generator to update blocked_spells Repo
This commit is contained in:
Fryguy 2023-12-08 15:19:54 -05:00 committed by GitHub
parent 56c29154f0
commit 841d7f2700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@
#include "../../strings.h" #include "../../strings.h"
#include <ctime> #include <ctime>
class BaseBlockedSpellsRepository { class BaseBlockedSpellsRepository {
public: public:
struct BlockedSpells { struct BlockedSpells {
@ -31,6 +32,10 @@ public:
float z_diff; float z_diff;
std::string message; std::string message;
std::string description; std::string description;
int8_t min_expansion;
int8_t max_expansion;
std::string content_flags;
std::string content_flags_disabled;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@ -53,6 +58,10 @@ public:
"z_diff", "z_diff",
"message", "message",
"description", "description",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
}; };
} }
@ -71,6 +80,10 @@ public:
"z_diff", "z_diff",
"message", "message",
"description", "description",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
}; };
} }
@ -111,18 +124,22 @@ public:
{ {
BlockedSpells e{}; BlockedSpells e{};
e.id = 0; e.id = 0;
e.spellid = 0; e.spellid = 0;
e.type = 0; e.type = 0;
e.zoneid = 0; e.zoneid = 0;
e.x = 0; e.x = 0;
e.y = 0; e.y = 0;
e.z = 0; e.z = 0;
e.x_diff = 0; e.x_diff = 0;
e.y_diff = 0; e.y_diff = 0;
e.z_diff = 0; e.z_diff = 0;
e.message = ""; e.message = "";
e.description = ""; e.description = "";
e.min_expansion = -1;
e.max_expansion = -1;
e.content_flags = "";
e.content_flags_disabled = "";
return e; return e;
} }
@ -148,8 +165,9 @@ public:
{ {
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE {} = {} LIMIT 1",
BaseSelect(), BaseSelect(),
PrimaryKey(),
blocked_spells_id blocked_spells_id
) )
); );
@ -158,18 +176,22 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
BlockedSpells e{}; BlockedSpells e{};
e.id = static_cast<int32_t>(atoi(row[0])); e.id = static_cast<int32_t>(atoi(row[0]));
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10)); e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
e.type = static_cast<int8_t>(atoi(row[2])); e.type = static_cast<int8_t>(atoi(row[2]));
e.zoneid = static_cast<int32_t>(atoi(row[3])); e.zoneid = static_cast<int32_t>(atoi(row[3]));
e.x = strtof(row[4], nullptr); e.x = strtof(row[4], nullptr);
e.y = strtof(row[5], nullptr); e.y = strtof(row[5], nullptr);
e.z = strtof(row[6], nullptr); e.z = strtof(row[6], nullptr);
e.x_diff = strtof(row[7], nullptr); e.x_diff = strtof(row[7], nullptr);
e.y_diff = strtof(row[8], nullptr); e.y_diff = strtof(row[8], nullptr);
e.z_diff = strtof(row[9], nullptr); e.z_diff = strtof(row[9], nullptr);
e.message = row[10] ? row[10] : ""; e.message = row[10] ? row[10] : "";
e.description = row[11] ? row[11] : ""; e.description = row[11] ? row[11] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
e.content_flags = row[14] ? row[14] : "";
e.content_flags_disabled = row[15] ? row[15] : "";
return e; return e;
} }
@ -214,6 +236,10 @@ public:
v.push_back(columns[9] + " = " + std::to_string(e.z_diff)); v.push_back(columns[9] + " = " + std::to_string(e.z_diff));
v.push_back(columns[10] + " = '" + Strings::Escape(e.message) + "'"); v.push_back(columns[10] + " = '" + Strings::Escape(e.message) + "'");
v.push_back(columns[11] + " = '" + Strings::Escape(e.description) + "'"); v.push_back(columns[11] + " = '" + Strings::Escape(e.description) + "'");
v.push_back(columns[12] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[13] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[14] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[15] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@ -247,6 +273,10 @@ public:
v.push_back(std::to_string(e.z_diff)); v.push_back(std::to_string(e.z_diff));
v.push_back("'" + Strings::Escape(e.message) + "'"); v.push_back("'" + Strings::Escape(e.message) + "'");
v.push_back("'" + Strings::Escape(e.description) + "'"); v.push_back("'" + Strings::Escape(e.description) + "'");
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@ -288,6 +318,10 @@ public:
v.push_back(std::to_string(e.z_diff)); v.push_back(std::to_string(e.z_diff));
v.push_back("'" + Strings::Escape(e.message) + "'"); v.push_back("'" + Strings::Escape(e.message) + "'");
v.push_back("'" + Strings::Escape(e.description) + "'"); v.push_back("'" + Strings::Escape(e.description) + "'");
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@ -321,18 +355,22 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
BlockedSpells e{}; BlockedSpells e{};
e.id = static_cast<int32_t>(atoi(row[0])); e.id = static_cast<int32_t>(atoi(row[0]));
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10)); e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
e.type = static_cast<int8_t>(atoi(row[2])); e.type = static_cast<int8_t>(atoi(row[2]));
e.zoneid = static_cast<int32_t>(atoi(row[3])); e.zoneid = static_cast<int32_t>(atoi(row[3]));
e.x = strtof(row[4], nullptr); e.x = strtof(row[4], nullptr);
e.y = strtof(row[5], nullptr); e.y = strtof(row[5], nullptr);
e.z = strtof(row[6], nullptr); e.z = strtof(row[6], nullptr);
e.x_diff = strtof(row[7], nullptr); e.x_diff = strtof(row[7], nullptr);
e.y_diff = strtof(row[8], nullptr); e.y_diff = strtof(row[8], nullptr);
e.z_diff = strtof(row[9], nullptr); e.z_diff = strtof(row[9], nullptr);
e.message = row[10] ? row[10] : ""; e.message = row[10] ? row[10] : "";
e.description = row[11] ? row[11] : ""; e.description = row[11] ? row[11] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
e.content_flags = row[14] ? row[14] : "";
e.content_flags_disabled = row[15] ? row[15] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@ -357,18 +395,22 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
BlockedSpells e{}; BlockedSpells e{};
e.id = static_cast<int32_t>(atoi(row[0])); e.id = static_cast<int32_t>(atoi(row[0]));
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10)); e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
e.type = static_cast<int8_t>(atoi(row[2])); e.type = static_cast<int8_t>(atoi(row[2]));
e.zoneid = static_cast<int32_t>(atoi(row[3])); e.zoneid = static_cast<int32_t>(atoi(row[3]));
e.x = strtof(row[4], nullptr); e.x = strtof(row[4], nullptr);
e.y = strtof(row[5], nullptr); e.y = strtof(row[5], nullptr);
e.z = strtof(row[6], nullptr); e.z = strtof(row[6], nullptr);
e.x_diff = strtof(row[7], nullptr); e.x_diff = strtof(row[7], nullptr);
e.y_diff = strtof(row[8], nullptr); e.y_diff = strtof(row[8], nullptr);
e.z_diff = strtof(row[9], nullptr); e.z_diff = strtof(row[9], nullptr);
e.message = row[10] ? row[10] : ""; e.message = row[10] ? row[10] : "";
e.description = row[11] ? row[11] : ""; e.description = row[11] ? row[11] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
e.content_flags = row[14] ? row[14] : "";
e.content_flags_disabled = row[15] ? row[15] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }