[Feature] Add Rule to Limit Task Update Messages (#4459)

* [Feature] Add Rule to Limit Task Update Messages

* Update task_client_state.cpp

* Update task_client_state.cpp

* Change rule
This commit is contained in:
Alex King 2024-08-27 21:49:07 -04:00 committed by GitHub
parent ff16a76481
commit 39876ab858
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -715,6 +715,7 @@ RULE_BOOL(TaskSystem, ExpRewardsIgnoreLevelBasedEXPMods, false, "Rewarding Level
RULE_INT(TaskSystem, SharedTasksWorldProcessRate, 6000, "Timer interval (milliseconds) that shared tasks are processed in world")
RULE_INT(TaskSystem, SharedTasksTerminateTimerMS, 120000, "Delay (milliseconds) until a shared task is terminated if requirements are no longer met after member removal (default: 2 minutes)")
RULE_BOOL(TaskSystem, UpdateOneElementPerTask, true, "If true (live-like) task updates only increment the first matching activity. If false all matching elements will be incremented.")
RULE_INT(TaskSystem, MaxUpdateMessages, 50, "Maximum update messages for non-GiveCash activity types in IncrementDoneCount")
RULE_CATEGORY_END()
RULE_CATEGORY(Range)

View File

@ -869,7 +869,12 @@ int ClientTaskState::IncrementDoneCount(
if (task_data->type != TaskType::Shared) {
// live messages for each increment of non-shared tasks
auto activity_type = task_data->activity_information[activity_id].activity_type;
int msg_count = activity_type == TaskActivityType::GiveCash ? 1 : count;
int msg_count = 1;
if (activity_type != TaskActivityType::GiveCash) {
msg_count = std::min(count, RuleI(TaskSystem, MaxUpdateMessages));
}
for (int i = 0; i < msg_count; ++i) {
client->MessageString(Chat::DefaultText, TASK_UPDATED, task_data->title.c_str());
}