[Rule] Allow maximum per kill AA amount (#4329)

* [Rule] Allow maximum per kill AA amount

* Adjustments per comments

* Finalize.

* Update ruletypes.h

---------

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
Fryguy 2024-05-25 17:48:58 -04:00 committed by GitHub
parent 3e34447172
commit c56742a2a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -817,6 +817,7 @@ RULE_INT(AA, ModernAAScalingAAMinimum, 0, "The minimum number of earned AA befor
RULE_INT(AA, ModernAAScalingAALimit, 4000, "The number of earned AA when AA experience scaling ends")
RULE_BOOL(AA, SoundForAAEarned, false, "Play sound when AA point earned")
RULE_INT(AA, UnusedAAPointCap, -1, "Cap for Unused AA Points. Default: -1. NOTE: DO NOT LOWER THIS WITHOUT KNOWING WHAT YOU ARE DOING. MAY RESULT IN PLAYERS LOSING AAs.")
RULE_INT(AA, MaxAAEXPPerKill, -1, "Maximum AA EXP per Kill (3425214 is about 7%) - Default: -1 will disable the check")
RULE_CATEGORY_END()
RULE_CATEGORY(Console)

View File

@ -530,6 +530,11 @@ void Client::AddEXP(ExpSource exp_source, uint64 in_add_exp, uint8 conlevel, boo
aaexp = ScaleAAXPBasedOnCurrentAATotal(GetAAPoints(), aaexp);
}
// Check for AA XP Cap
if (RuleI(AA, MaxAAEXPPerKill) >= 0 && aaexp > RuleI(AA, MaxAAEXPPerKill)) {
aaexp = RuleI(AA, MaxAAEXPPerKill);
}
// Get current AA XP total
uint32 had_aaexp = GetAAXP();