mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Expansion filtering for doors
This commit is contained in:
parent
c1e58673b2
commit
8a711f3c64
@ -31,23 +31,28 @@ namespace ContentFilterCriteria {
|
||||
std::string criteria;
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND (min_expansion >= {} OR min_expansion = 0)",
|
||||
" AND (min_expansion <= {} OR min_expansion = 0)",
|
||||
content_service.GetCurrentExpansion()
|
||||
);
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND (max_expansion <= {} OR max_expansion = 0)",
|
||||
" AND (max_expansion >= {} OR max_expansion = 0)",
|
||||
content_service.GetCurrentExpansion()
|
||||
);
|
||||
|
||||
std::vector<std::string> flags = content_service.GetContentFlags();
|
||||
for (auto &flag: flags) {
|
||||
for (auto &flag: flags) {
|
||||
flag = "'" + flag + "'";
|
||||
}
|
||||
|
||||
std::string flags_in_filter;
|
||||
if (!flags.empty()) {
|
||||
flags_in_filter = fmt::format("OR content_flags IN ({})", implode(", ", flags));
|
||||
}
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND (content_flags IS NULL OR content_flags IN ({}))",
|
||||
implode(", ", flags)
|
||||
" AND (content_flags IS NULL {})",
|
||||
flags_in_filter
|
||||
);
|
||||
|
||||
return std::string(criteria);
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "string_ids.h"
|
||||
#include "worldserver.h"
|
||||
#include "zonedb.h"
|
||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
@ -716,10 +717,12 @@ bool ZoneDatabase::LoadDoors(int32 door_count, Door *into, const char *zone_name
|
||||
" WHERE "
|
||||
" zone = '%s' "
|
||||
" AND ( version = % u OR version = - 1 ) "
|
||||
" %s "
|
||||
" ORDER BY "
|
||||
" doorid ASC ",
|
||||
zone_name,
|
||||
version
|
||||
version,
|
||||
ContentFilterCriteria::apply().c_str()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user