[Rules] Add World:MaximumQuestErrors Rule (#3349)

* [Rules] Add World:MaximumQuestErrors Rule

# Notes
- Allows operators to display more than 30 errors with #questerrors if they want.

* Update quest_interface.h
This commit is contained in:
Alex King 2023-05-21 18:48:30 -04:00 committed by GitHub
parent 21755a9f9e
commit f0152cef66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -297,6 +297,7 @@ RULE_BOOL(World, StartZoneSameAsBindOnCreation, true, "Should the start zone alw
RULE_BOOL(World, EnforceCharacterLimitAtLogin, false, "Enforce the limit for characters that are online at login") RULE_BOOL(World, EnforceCharacterLimitAtLogin, false, "Enforce the limit for characters that are online at login")
RULE_BOOL(World, EnableDevTools, true, "Enable or Disable the Developer Tools globally (Most of the time you want this enabled)") RULE_BOOL(World, EnableDevTools, true, "Enable or Disable the Developer Tools globally (Most of the time you want this enabled)")
RULE_BOOL(World, EnableChecksumVerification, false, "Enable or Disable the Checksum Verification for eqgame.exe and spells_us.txt") RULE_BOOL(World, EnableChecksumVerification, false, "Enable or Disable the Checksum Verification for eqgame.exe and spells_us.txt")
RULE_INT(World, MaximumQuestErrors, 30, "Changes the maximum number of quest errors that can be displayed in #questerrors, default is 30")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Zone) RULE_CATEGORY(Zone)

View File

@ -11,8 +11,15 @@ void command_questerrors(Client *c, const Seperator *sep)
int error_index = 0; int error_index = 0;
for (auto quest_error : quest_errors) { for (auto quest_error : quest_errors) {
if (error_index >= 30) { if (error_index >= RuleI(World, MaximumQuestErrors)) {
c->Message(Chat::White, "Maximum of 30 errors shown."); c->Message(
Chat::White,
fmt::format(
"Maximum of {} error{} shown.",
RuleI(World, MaximumQuestErrors),
RuleI(World, MaximumQuestErrors) != 1 ? "s" : ""
).c_str()
);
break; break;
} }

View File

@ -116,7 +116,6 @@ public:
virtual uint32 GetIdentifier() = 0; virtual uint32 GetIdentifier() = 0;
virtual void RemoveEncounter(const std::string &name) { } virtual void RemoveEncounter(const std::string &name) { }
//TODO: Set maximum quest errors instead of hard coding it
virtual void GetErrors(std::list<std::string> &quest_errors) { virtual void GetErrors(std::list<std::string> &quest_errors) {
quest_errors.insert(quest_errors.end(), errors_.begin(), errors_.end()); quest_errors.insert(quest_errors.end(), errors_.begin(), errors_.end());
} }
@ -126,7 +125,7 @@ public:
LogQuestErrors("{}", Strings::Trim(error)); LogQuestErrors("{}", Strings::Trim(error));
errors_.push_back(error); errors_.push_back(error);
if(errors_.size() > 30) { if (errors_.size() > RuleI(World, MaximumQuestErrors)) {
errors_.pop_front(); errors_.pop_front();
} }
} }