mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 02:06:50 +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:
@@ -459,6 +459,7 @@ SET(gm_commands
|
||||
gm_commands/refreshgroup.cpp
|
||||
gm_commands/reloadaa.cpp
|
||||
gm_commands/reloadallrules.cpp
|
||||
gm_commands/reloadcontentflags.cpp
|
||||
gm_commands/reloademote.cpp
|
||||
gm_commands/reloadlevelmods.cpp
|
||||
gm_commands/reloadmerchants.cpp
|
||||
|
||||
@@ -295,6 +295,7 @@ int command_init(void)
|
||||
command_add("refreshgroup", "- Refreshes Group.", AccountStatus::Player, command_refreshgroup) ||
|
||||
command_add("reloadaa", "Reloads AA data", AccountStatus::GMMgmt, command_reloadaa) ||
|
||||
command_add("reloadallrules", "Executes a reload of all rules.", AccountStatus::QuestTroupe, command_reloadallrules) ||
|
||||
command_add("reloadcontentflags", "Executes a reload of all expansion and content flags", AccountStatus::QuestTroupe, command_reloadcontentflags) ||
|
||||
command_add("reloademote", "Reloads NPC Emotes", AccountStatus::QuestTroupe, command_reloademote) ||
|
||||
command_add("reloadlevelmods", nullptr, AccountStatus::Max, command_reloadlevelmods) ||
|
||||
command_add("reloadmerchants", nullptr, AccountStatus::Max, command_reloadmerchants) ||
|
||||
|
||||
@@ -216,6 +216,7 @@ void command_randomfeatures(Client *c, const Seperator *sep);
|
||||
void command_refreshgroup(Client *c, const Seperator *sep);
|
||||
void command_reloadaa(Client *c, const Seperator *sep);
|
||||
void command_reloadallrules(Client *c, const Seperator *sep);
|
||||
void command_reloadcontentflags(Client *c, const Seperator *sep);
|
||||
void command_reloademote(Client *c, const Seperator *sep);
|
||||
void command_reloadlevelmods(Client *c, const Seperator *sep);
|
||||
void command_reloadmerchants(Client *c, const Seperator *sep);
|
||||
|
||||
+10
-9
@@ -4802,7 +4802,8 @@ XS(XS__SetContentFlag)
|
||||
|
||||
std::string flag_name = (std::string) SvPV_nolen(ST(0));
|
||||
bool enabled = (int) SvIV(ST(1)) != 0;
|
||||
ZoneStore::SetContentFlag(flag_name, enabled);
|
||||
|
||||
content_service.SetContentFlag(flag_name, enabled);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@@ -5141,7 +5142,7 @@ XS(XS__gethexcolorcode) {
|
||||
sv_setpv(TARG, hex_color_code.c_str());
|
||||
XSprePUSH;
|
||||
PUSHTARG;
|
||||
XSRETURN(1);
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getaaexpmodifierbycharid);
|
||||
@@ -5149,7 +5150,7 @@ XS(XS__getaaexpmodifierbycharid) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: quest::getaaexpmodifierbycharid(uint32 character_id, uint32 zone_id)");
|
||||
|
||||
|
||||
dXSTARG;
|
||||
double aa_modifier;
|
||||
uint32 character_id = (uint32) SvUV(ST(0));
|
||||
@@ -5165,7 +5166,7 @@ XS(XS__getexpmodifierbycharid) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: quest::getexpmodifierbycharid(uint32 character_id, uint32 zone_id)");
|
||||
|
||||
|
||||
dXSTARG;
|
||||
double exp_modifier;
|
||||
uint32 character_id = (uint32) SvUV(ST(0));
|
||||
@@ -5313,7 +5314,7 @@ XS(XS__getspellstat) {
|
||||
uint8 slot = 0;
|
||||
if (items == 3)
|
||||
slot = (uint8) SvUV(ST(2));
|
||||
|
||||
|
||||
stat_value = quest_manager.getspellstat(spell_id, stat_identifier, slot);
|
||||
|
||||
XSprePUSH;
|
||||
@@ -7551,7 +7552,7 @@ XS(XS__worldwideassigntask) {
|
||||
|
||||
if (items == 3)
|
||||
max_status = (uint8) SvUV(ST(2));
|
||||
|
||||
|
||||
quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
@@ -7616,7 +7617,7 @@ XS(XS__worldwidedisabletask) {
|
||||
|
||||
if (items == 3)
|
||||
max_status = (uint8) SvUV(ST(2));
|
||||
|
||||
|
||||
quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
@@ -7640,7 +7641,7 @@ XS(XS__worldwideenabletask) {
|
||||
|
||||
if (items == 3)
|
||||
max_status = (uint8) SvUV(ST(2));
|
||||
|
||||
|
||||
quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
@@ -7664,7 +7665,7 @@ XS(XS__worldwidefailtask) {
|
||||
|
||||
if (items == 3)
|
||||
max_status = (uint8) SvUV(ST(2));
|
||||
|
||||
|
||||
quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#include "../client.h"
|
||||
#include "../worldserver.h"
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
void command_reloadcontentflags(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c) {
|
||||
auto pack = new ServerPacket(ServerOP_ReloadContentFlags, 0);
|
||||
worldserver.SendPacket(pack);
|
||||
c->Message(Chat::Red, "Successfully sent the packet to world to reload content flags globally.");
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1410,7 +1410,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
|
||||
lua_remove_spawn_point(spawn2_id);
|
||||
|
||||
auto t = new Spawn2(spawn2_id, spawngroup_id, x, y, z, heading, respawn,
|
||||
variance, timeleft, grid, path_when_zone_idle, condition_id,
|
||||
variance, timeleft, grid, path_when_zone_idle, condition_id,
|
||||
condition_min_value, enabled, static_cast<EmuAppearance>(animation));
|
||||
|
||||
zone->spawn2_list.Insert(t);
|
||||
@@ -1743,7 +1743,7 @@ bool lua_is_content_flag_enabled(std::string content_flag){
|
||||
}
|
||||
|
||||
void lua_set_content_flag(std::string flag_name, bool enabled){
|
||||
ZoneStore::SetContentFlag(flag_name, enabled);
|
||||
content_service.SetContentFlag(flag_name, enabled);
|
||||
}
|
||||
|
||||
Lua_Expedition lua_get_expedition() {
|
||||
|
||||
+3
-3
@@ -386,9 +386,9 @@ int main(int argc, char** argv) {
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
}
|
||||
|
||||
content_service.SetExpansionContext();
|
||||
|
||||
ZoneStore::LoadContentFlags();
|
||||
content_service.SetDatabase(&database)
|
||||
->SetExpansionContext()
|
||||
->ReloadContentFlags();
|
||||
|
||||
event_scheduler.SetDatabase(&database)->LoadScheduledEvents();
|
||||
|
||||
|
||||
+5
-2
@@ -244,8 +244,11 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
|
||||
AND
|
||||
spawnentry.spawngroupID = spawn2.spawngroupID
|
||||
AND
|
||||
zone = '{}'),
|
||||
zone_name
|
||||
zone = '{}'
|
||||
{}
|
||||
),
|
||||
zone_name,
|
||||
ContentFilterCriteria::apply("spawnentry")
|
||||
);
|
||||
|
||||
results = QueryDatabase(query);
|
||||
|
||||
+45
-17
@@ -1977,6 +1977,34 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset(), true);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadContentFlags: {
|
||||
if (zone) {
|
||||
worldserver.SendEmoteMessage(
|
||||
0,
|
||||
0,
|
||||
AccountStatus::GMAdmin,
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"Content flags (and expansion) reloaded for {}.",
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
zone->GetLongName(),
|
||||
zone->GetZoneID()
|
||||
),
|
||||
(
|
||||
zone->GetInstanceID() ?
|
||||
fmt::format(
|
||||
"Instance ID: {}",
|
||||
zone->GetInstanceID()
|
||||
) :
|
||||
""
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
content_service.SetExpansionContext()->ReloadContentFlags();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadLogs: {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
break;
|
||||
@@ -2069,7 +2097,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
DialogueWindow::Render(client.second, message);
|
||||
}
|
||||
@@ -2243,7 +2271,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_CZMarquee:
|
||||
@@ -2290,7 +2318,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
client.second->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, message);
|
||||
}
|
||||
@@ -2343,7 +2371,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
client.second->Message(type, message);
|
||||
}
|
||||
@@ -2425,7 +2453,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
switch (update_subtype) {
|
||||
case CZMoveUpdateSubtype_MoveZone:
|
||||
@@ -2492,7 +2520,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
client.second->SetEntityVariable(variable_name, variable_value);
|
||||
}
|
||||
@@ -2549,7 +2577,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
client.second->Signal(signal);
|
||||
}
|
||||
@@ -2609,7 +2637,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
if (client_raid) {
|
||||
for (int member_index = 0; member_index < MAX_RAID_MEMBERS; member_index++) {
|
||||
if (client_raid->members[member_index].member && client_raid->members[member_index].member->IsClient()) {
|
||||
auto raid_member = client_raid->members[member_index].member->CastToClient();
|
||||
auto raid_member = client_raid->members[member_index].member->CastToClient();
|
||||
switch (update_subtype) {
|
||||
case CZSpellUpdateSubtype_Cast:
|
||||
raid_member->SpellFinished(spell_id, raid_member);
|
||||
@@ -2635,7 +2663,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
switch (update_subtype) {
|
||||
case CZSpellUpdateSubtype_Cast:
|
||||
@@ -2792,9 +2820,9 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (update_type == CZUpdateType_Expedition) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
for (auto &client: entity_list.GetClientList()) {
|
||||
if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) {
|
||||
switch (update_subtype) {
|
||||
case CZTaskUpdateSubtype_ActivityReset:
|
||||
@@ -2968,7 +2996,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
uint8 min_status = WWSEV->min_status;
|
||||
uint8 max_status = WWSEV->max_status;
|
||||
if (update_type == WWSetEntityVariableUpdateType_Character) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
if (client.second->Admin() >= min_status && (client.second->Admin() <= max_status || max_status == AccountStatus::Player)) {
|
||||
client.second->SetEntityVariable(variable_name, variable_value);
|
||||
}
|
||||
@@ -2988,7 +3016,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
uint8 min_status = WWS->min_status;
|
||||
uint8 max_status = WWS->max_status;
|
||||
if (update_type == WWSignalUpdateType_Character) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
if (client.second->Admin() >= min_status && (client.second->Admin() <= max_status || max_status == AccountStatus::Player)) {
|
||||
client.second->Signal(signal);
|
||||
}
|
||||
@@ -3008,13 +3036,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
uint8 min_status = WWS->min_status;
|
||||
uint8 max_status = WWS->max_status;
|
||||
if (update_type == WWSpellUpdateType_Cast) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
if (client.second->Admin() >= min_status && (client.second->Admin() <= max_status || max_status == AccountStatus::Player)) {
|
||||
client.second->SpellFinished(spell_id, client.second);
|
||||
}
|
||||
}
|
||||
} else if (update_type == WWSpellUpdateType_Remove) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
if (client.second->Admin() >= min_status && (client.second->Admin() <= max_status || max_status == AccountStatus::Player)) {
|
||||
client.second->BuffFadeBySpellID(spell_id);
|
||||
}
|
||||
@@ -3031,8 +3059,8 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
int update_count = WWTU->update_count;
|
||||
bool enforce_level_requirement = WWTU->enforce_level_requirement;
|
||||
uint8 min_status = WWTU->min_status;
|
||||
uint8 max_status = WWTU->max_status;
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
uint8 max_status = WWTU->max_status;
|
||||
for (auto &client : entity_list.GetClientList()) {
|
||||
if (client.second->Admin() >= min_status && (client.second->Admin() <= max_status || max_status == AccountStatus::Player)) {
|
||||
switch (update_type) {
|
||||
case WWTaskUpdateType_ActivityReset:
|
||||
|
||||
+3
-4
@@ -1255,9 +1255,8 @@ void Zone::ReloadStaticData() {
|
||||
);
|
||||
} // if that fails, try the file name, then load defaults
|
||||
|
||||
content_service.SetExpansionContext();
|
||||
content_service.SetExpansionContext()->ReloadContentFlags();
|
||||
|
||||
ZoneStore::LoadContentFlags();
|
||||
|
||||
LogInfo("Zone Static Data Reloaded");
|
||||
}
|
||||
@@ -2749,7 +2748,7 @@ uint32 Zone::GetCurrencyID(uint32 item_id)
|
||||
if (!item_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (const auto& alternate_currency : AlternateCurrencies) {
|
||||
if (item_id == alternate_currency.item_id) {
|
||||
return alternate_currency.id;
|
||||
@@ -2772,4 +2771,4 @@ uint32 Zone::GetCurrencyItemID(uint32 currency_id)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void ZoneEventScheduler::Process(Zone *zone, WorldContentService *content_servic
|
||||
auto flag_name = e.event_data;
|
||||
if (!flag_name.empty()) {
|
||||
LogScheduler("Deactivating event [{}] resetting content flags", e.description);
|
||||
content_service->ReloadContentFlags(*m_database);
|
||||
content_service->ReloadContentFlags();
|
||||
}
|
||||
|
||||
// force active events clear and reapply all active events because we reset the entire state
|
||||
@@ -117,8 +117,13 @@ void ZoneEventScheduler::Process(Zone *zone, WorldContentService *content_servic
|
||||
flag_name
|
||||
);
|
||||
|
||||
// add new flag entity to stack
|
||||
auto flags = content_service->GetContentFlags();
|
||||
flags.push_back(flag_name);
|
||||
auto f = ContentFlagsRepository::NewEntity();
|
||||
f.flag_name = flag_name;
|
||||
f.enabled = 1;
|
||||
flags.push_back(f);
|
||||
|
||||
content_service->SetContentFlags(flags);
|
||||
m_active_events.push_back(e);
|
||||
}
|
||||
|
||||
@@ -160,41 +160,3 @@ ZoneRepository::Zone ZoneStore::GetZone(const char *in_zone_name)
|
||||
|
||||
return ZoneRepository::Zone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
void ZoneStore::LoadContentFlags()
|
||||
{
|
||||
content_service.ReloadContentFlags(database);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value in the database and proceeds to load content flags into the server context again
|
||||
*
|
||||
* @param content_flag_name
|
||||
* @param enabled
|
||||
*/
|
||||
void ZoneStore::SetContentFlag(const std::string &content_flag_name, bool enabled)
|
||||
{
|
||||
auto content_flags = ContentFlagsRepository::GetWhere(database,
|
||||
fmt::format("flag_name = '{}'", content_flag_name)
|
||||
);
|
||||
|
||||
auto content_flag = ContentFlagsRepository::NewEntity();
|
||||
if (!content_flags.empty()) {
|
||||
content_flag = content_flags.front();
|
||||
}
|
||||
|
||||
content_flag.enabled = enabled ? 1 : 0;
|
||||
content_flag.flag_name = content_flag_name;
|
||||
|
||||
if (!content_flags.empty()) {
|
||||
ContentFlagsRepository::UpdateOne(database, content_flag);
|
||||
}
|
||||
else {
|
||||
ContentFlagsRepository::InsertOne(database, content_flag);
|
||||
}
|
||||
|
||||
LoadContentFlags();
|
||||
}
|
||||
|
||||
@@ -42,9 +42,6 @@ public:
|
||||
std::string GetZoneLongName(uint32 zone_id);
|
||||
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
|
||||
const char *GetZoneLongName(uint32 zone_id, bool error_unknown = false);
|
||||
|
||||
static void LoadContentFlags();
|
||||
static void SetContentFlag(const std::string& content_flag_name, bool enabled);
|
||||
};
|
||||
|
||||
extern ZoneStore zone_store;
|
||||
|
||||
Reference in New Issue
Block a user