mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-17 22:51:30 +00:00
Add content_flags_disabled field for additional filtering
This commit is contained in:
parent
630ab5e69d
commit
e82f0254b0
@ -54,19 +54,31 @@ namespace ContentFilterCriteria {
|
|||||||
);
|
);
|
||||||
|
|
||||||
std::vector<std::string> flags = content_service.GetContentFlags();
|
std::vector<std::string> flags = content_service.GetContentFlags();
|
||||||
std::string flags_in_filter;
|
std::string flags_in_filter_enabled;
|
||||||
|
std::string flags_in_filter_disabled;
|
||||||
if (!flags.empty()) {
|
if (!flags.empty()) {
|
||||||
flags_in_filter = fmt::format(
|
flags_in_filter_enabled = fmt::format(
|
||||||
" OR CONCAT(',', {}content_flags, ',') REGEXP ',({}),' ",
|
" OR CONCAT(',', {}content_flags, ',') REGEXP ',({}),' ",
|
||||||
table_prefix,
|
table_prefix,
|
||||||
implode("|", flags)
|
implode("|", flags)
|
||||||
);
|
);
|
||||||
|
flags_in_filter_disabled = fmt::format(
|
||||||
|
" OR CONCAT(',', {}content_flags, ',') NOT REGEXP ',({}),' ",
|
||||||
|
table_prefix,
|
||||||
|
implode("|", flags)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria += fmt::format(
|
criteria += fmt::format(
|
||||||
" AND ({}content_flags IS NULL{}) ",
|
" AND ({}content_flags IS NULL{}) ",
|
||||||
table_prefix,
|
table_prefix,
|
||||||
flags_in_filter
|
flags_in_filter_enabled
|
||||||
|
);
|
||||||
|
|
||||||
|
criteria += fmt::format(
|
||||||
|
" AND ({}content_flags_disabled IS NULL{}) ",
|
||||||
|
table_prefix,
|
||||||
|
flags_in_filter_disabled
|
||||||
);
|
);
|
||||||
|
|
||||||
return std::string(criteria);
|
return std::string(criteria);
|
||||||
|
|||||||
@ -83,3 +83,22 @@ update doors set min_expansion = 4 where name like '%POKTELE%';
|
|||||||
|
|
||||||
-- content flags
|
-- content flags
|
||||||
CREATE TABLE `content_flags` (`id` int AUTO_INCREMENT,`flag_name` varchar(75),`enabled` tinyint,`notes` text, PRIMARY KEY (id));
|
CREATE TABLE `content_flags` (`id` int AUTO_INCREMENT,`flag_name` varchar(75),`enabled` tinyint,`notes` text, PRIMARY KEY (id));
|
||||||
|
|
||||||
|
-- content flags disabled
|
||||||
|
|
||||||
|
ALTER TABLE `doors` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `fishing` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `forage` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `global_loot` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `ground_spawns` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `lootdrop` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `loottable` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `merchantlist` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `object` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `spawn2` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `start_zones` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `starting_items` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `tradeskill_recipe` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `traps` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `zone` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
|
ALTER TABLE `zone_points` ADD `content_flags_disabled` varchar(100) NULL;
|
||||||
@ -57,6 +57,7 @@
|
|||||||
#include "../common/data_verification.h"
|
#include "../common/data_verification.h"
|
||||||
#include "zone_reload.h"
|
#include "zone_reload.h"
|
||||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
|
#include "../common/repositories/content_flags_repository.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@ -1230,8 +1231,29 @@ void Zone::ReloadStaticData() {
|
|||||||
zone->LoadNPCEmotes(&NPCEmoteList);
|
zone->LoadNPCEmotes(&NPCEmoteList);
|
||||||
|
|
||||||
//load the zone config file.
|
//load the zone config file.
|
||||||
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) // try loading the zone name...
|
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) { // try loading the zone name...
|
||||||
LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults
|
LoadZoneCFG(
|
||||||
|
zone->GetFileName(),
|
||||||
|
zone->GetInstanceVersion()
|
||||||
|
);
|
||||||
|
} // if that fails, try the file name, then load defaults
|
||||||
|
|
||||||
|
content_service.SetExpansionContext();
|
||||||
|
|
||||||
|
std::vector<std::string> set_content_flags;
|
||||||
|
auto content_flags = ContentFlagsRepository::GetWhere("enabled = 1");
|
||||||
|
set_content_flags.reserve(content_flags.size());
|
||||||
|
|
||||||
|
for (auto &flags: content_flags) {
|
||||||
|
set_content_flags.push_back(flags.flag_name);
|
||||||
|
|
||||||
|
LogInfo(
|
||||||
|
"Enabled content flag [{}]",
|
||||||
|
flags.flag_name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
content_service.SetContentFlags(set_content_flags);
|
||||||
|
|
||||||
LogInfo("Zone Static Data Reloaded");
|
LogInfo("Zone Static Data Reloaded");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user