Skip to content

Commit

Permalink
[Rules] Add World:Rules Rule (#4194)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
Kinglykrab authored Mar 23, 2024
1 parent e4157f0 commit 8826d7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions common/ruletypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 7 additions & 9 deletions zone/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}

Expand Down

0 comments on commit 8826d7b

Please sign in to comment.