mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
[Expansion] Content Filtering Adjustments (#1910)
* Change default expansion values for ALL to -1 from 0 * Adjust content_filter_criteria * Refactor content filtering logic * Allow flag strings to also just be empty instead of null * Formatting * Editor oops
This commit is contained in:
@@ -40,43 +40,48 @@ namespace ContentFilterCriteria {
|
||||
}
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND ({}min_expansion <= {} OR {}min_expansion = 0)",
|
||||
" AND ({}min_expansion <= {} OR {}min_expansion = -1)",
|
||||
table_prefix,
|
||||
current_expansion_filter_criteria,
|
||||
table_prefix
|
||||
);
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND ({}max_expansion >= {} OR {}max_expansion = 0)",
|
||||
" AND ({}max_expansion >= {} OR {}max_expansion = -1)",
|
||||
table_prefix,
|
||||
current_expansion_filter_criteria,
|
||||
table_prefix
|
||||
);
|
||||
|
||||
std::vector<std::string> flags = content_service.GetContentFlags();
|
||||
std::vector<std::string> flags_disabled = content_service.GetContentFlagsDisabled();
|
||||
std::vector<std::string> flags_enabled = content_service.GetContentFlagsEnabled();
|
||||
std::string flags_in_filter_enabled;
|
||||
std::string flags_in_filter_disabled;
|
||||
if (!flags.empty()) {
|
||||
if (!flags_enabled.empty()) {
|
||||
flags_in_filter_enabled = fmt::format(
|
||||
" OR CONCAT(',', {}content_flags, ',') REGEXP ',({}),' ",
|
||||
table_prefix,
|
||||
implode("|", flags)
|
||||
implode("|", flags_enabled)
|
||||
);
|
||||
}
|
||||
if (!flags_disabled.empty()) {
|
||||
flags_in_filter_disabled = fmt::format(
|
||||
" OR CONCAT(',', {}content_flags_disabled, ',') NOT REGEXP ',({}),' ",
|
||||
" OR CONCAT(',', {}content_flags_disabled, ',') REGEXP ',({}),' ",
|
||||
table_prefix,
|
||||
implode("|", flags)
|
||||
implode("|", flags_disabled)
|
||||
);
|
||||
}
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND ({}content_flags IS NULL{}) ",
|
||||
" AND (({}content_flags IS NULL OR {}content_flags = ''){}) ",
|
||||
table_prefix,
|
||||
table_prefix,
|
||||
flags_in_filter_enabled
|
||||
);
|
||||
|
||||
criteria += fmt::format(
|
||||
" AND ({}content_flags_disabled IS NULL{}) ",
|
||||
" AND (({}content_flags_disabled IS NULL OR {}content_flags_disabled = ''){}) ",
|
||||
table_prefix,
|
||||
table_prefix,
|
||||
flags_in_filter_disabled
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user