Filter ground spawns [skip ci]

This commit is contained in:
Akkadius 2020-04-05 19:40:40 -05:00
parent 68a2af1bce
commit 9fbcd99be2

View File

@ -26,6 +26,7 @@
#include "quest_parser_collection.h"
#include "zonedb.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream>
@ -698,14 +699,20 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
//
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs) {
std::string query = StringFormat("SELECT max_x, max_y, max_z, "
"min_x, min_y, heading, name, "
"item, max_allowed, respawn_timer "
"FROM ground_spawns "
"WHERE zoneid = %i AND (version = %u OR version = -1) "
"LIMIT 50", zone_id, version);
auto results = QueryDatabase(query);
if (!results.Success()) {
std::string query = StringFormat(
"SELECT max_x, max_y, max_z, "
"min_x, min_y, heading, name, "
"item, max_allowed, respawn_timer "
"FROM ground_spawns "
"WHERE zoneid = %i AND (version = %u OR version = -1) %s "
"LIMIT 50",
zone_id,
version,
ContentFilterCriteria::apply().c_str()
);
auto results = QueryDatabase(query);
if (!results.Success()) {
return gs;
}