From c56742a2a8f18401bd939de40d34da2406d41680 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Sat, 25 May 2024 17:48:58 -0400 Subject: [PATCH] [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 --- common/ruletypes.h | 1 + zone/exp.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/common/ruletypes.h b/common/ruletypes.h index 32b4e7e75..24a904e96 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -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) diff --git a/zone/exp.cpp b/zone/exp.cpp index cf6a268ce..5727c0799 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -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();