Move spawn events from content table to server

This commit is contained in:
Akkadius 2020-04-18 23:26:53 -05:00
parent e4748a01e0
commit 85daee85b8
3 changed files with 16 additions and 16 deletions

View File

@ -218,7 +218,6 @@ namespace DatabaseSchema {
"skill_caps", "skill_caps",
"spawn2", "spawn2",
"spawn_conditions", "spawn_conditions",
"spawn_events",
"spawnentry", "spawnentry",
"spawngroup", "spawngroup",
"spells_new", "spells_new",
@ -254,6 +253,7 @@ namespace DatabaseSchema {
"launcher", "launcher",
"launcher_zones", "launcher_zones",
"spawn_condition_values", "spawn_condition_values",
"spawn_events",
"level_exp_mods", "level_exp_mods",
"logsys_categories", "logsys_categories",
"name_filter", "name_filter",

View File

@ -159,7 +159,7 @@ public:
int spawn_events_id int spawn_events_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -196,7 +196,7 @@ public:
int spawn_events_id int spawn_events_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -230,7 +230,7 @@ public:
update_values.push_back(columns[12] + " = " + std::to_string(spawn_events_entry.argument)); update_values.push_back(columns[12] + " = " + std::to_string(spawn_events_entry.argument));
update_values.push_back(columns[13] + " = " + std::to_string(spawn_events_entry.strict)); update_values.push_back(columns[13] + " = " + std::to_string(spawn_events_entry.strict));
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -263,7 +263,7 @@ public:
insert_values.push_back(std::to_string(spawn_events_entry.argument)); insert_values.push_back(std::to_string(spawn_events_entry.argument));
insert_values.push_back(std::to_string(spawn_events_entry.strict)); insert_values.push_back(std::to_string(spawn_events_entry.strict));
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@ -309,7 +309,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -324,7 +324,7 @@ public:
{ {
std::vector<SpawnEvents> all_entries; std::vector<SpawnEvents> all_entries;
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -361,7 +361,7 @@ public:
{ {
std::vector<SpawnEvents> all_entries; std::vector<SpawnEvents> all_entries;
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -397,7 +397,7 @@ public:
static int DeleteWhere(std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),

View File

@ -910,7 +910,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) {
event.next.day, event.next.month, event.next.day, event.next.month,
event.next.year, event.enabled? 1: 0, event.next.year, event.enabled? 1: 0,
event.strict? 1: 0, event.id); event.strict? 1: 0, event.id);
content_db.QueryDatabase(query); database.QueryDatabase(query);
} }
void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value) { void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value) {
@ -929,7 +929,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
"next_month, next_year, enabled, " "next_month, next_year, enabled, "
"action, argument, strict, zone " "action, argument, strict, zone "
"FROM spawn_events WHERE id = %d", event_id); "FROM spawn_events WHERE id = %d", event_id);
auto results = content_db.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
} }
@ -1009,7 +1009,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
query = StringFormat("SELECT id, cond_id, period, next_minute, next_hour, " query = StringFormat("SELECT id, cond_id, period, next_minute, next_hour, "
"next_day, next_month, next_year, enabled, action, argument, strict " "next_day, next_month, next_year, enabled, action, argument, strict "
"FROM spawn_events WHERE zone = '%s'", zone_name); "FROM spawn_events WHERE zone = '%s'", zone_name);
results = content_db.QueryDatabase(query); results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
} }