From 8826d7b927c8762b4ed9eb7dfcc5a1334b69a3e0 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:01:27 -0400 Subject: [PATCH] [Rules] Add World:Rules Rule (#4194) * [Rules] Add World:Rules Rule # Notes - Adds `World:Rules` rule to take the place of the variables table value. * Update client.cpp * Update client.cpp --- common/ruletypes.h | 1 + zone/client.cpp | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 042c9bec40..a1672d5a89 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -329,6 +329,7 @@ RULE_BOOL(World, UseItemLinksForKeyRing, false, "Uses item links for Key Ring Li RULE_BOOL(World, UseOldShadowKnightClassExport, true, "Disable to have Shadowknight show as Shadow Knight (live-like)") RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclude from IP-limit checks. Empty string to disable.") RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value") +RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C") RULE_CATEGORY_END() RULE_CATEGORY(Zone) diff --git a/zone/client.cpp b/zone/client.cpp index db3b76300d..1bc2760e22 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3786,14 +3786,12 @@ void Client::GetRaidAAs(RaidLeadershipAA_Struct *into) const { void Client::EnteringMessages(Client* client) { - std::string rules; - if (database.GetVariable("Rules", rules)) { - uint8 flag = database.GetAgreementFlag(client->AccountID()); + std::string rules = RuleS(World, Rules); + + if (!rules.empty() || database.GetVariable("Rules", rules)) { + const uint8 flag = database.GetAgreementFlag(client->AccountID()); if (!flag) { - auto rules_link = Saylink::Silent( - "#serverrules", - "rules" - ); + const std::string& rules_link = Saylink::Silent("#serverrules", "rules"); client->Message( Chat::White, @@ -3810,9 +3808,9 @@ void Client::EnteringMessages(Client* client) void Client::SendRules() { - std::string rules; + std::string rules = RuleS(World, Rules); - if (!database.GetVariable("Rules", rules)) { + if (rules.empty() && !database.GetVariable("Rules", rules)) { return; }