From 7d7b9d0238d11996d99adb8ea4d1e96aa6ae0ab7 Mon Sep 17 00:00:00 2001 From: Daerath Date: Tue, 2 Jan 2018 17:27:59 -0500 Subject: [PATCH] * Added rules for managing AA scaling. --- common/ruletypes.h | 4 ++++ zone/exp.cpp | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index ed5ae8e23..03624622e 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -156,6 +156,10 @@ RULE_BOOL(Character, UseOldBindWound, false) // Uses the original bind wound beh RULE_BOOL(Character, GrantHoTTOnCreate, false) // Grant Health of Target's Target leadership AA on character creation RULE_BOOL(Character, UseOldConSystem, false) // Grant Health of Target's Target leadership AA on character creation RULE_BOOL(Character, OPClientUpdateVisualDebug, false) // Shows a pulse and forward directional particle each time the client sends its position to server +RULE_BOOL(Character, UseModernAAExperienceScale, false) // Uses the newer approach to AA scaling based on total earned AA +RULE_REAL(Character, ModernAAScalingStartPercent, 1000) // 1000% or 10x AA XP at the start of the scaling range +RULE_INT(Character, ModernAAScalingAAMinimum, 0) // The minimum number of earned AA before AA XP scaling begins. +RULE_INT(Character, ModernAAScalingAALimit, 4000) // The number of earned AA when AA XP scaling ends. RULE_CATEGORY_END() RULE_CATEGORY(Mercs) diff --git a/zone/exp.cpp b/zone/exp.cpp index 0c4969d4f..70d261ff7 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -39,10 +39,9 @@ extern QueryServ* QServ; static uint32 ScaleAAXPBasedOnCurrentAATotal(int earnedAA, uint32 add_aaxp, float aatotalmod) { - // TODO: Read from Rules - float baseModifier = 1000; - int aaMinimum = 0; - int aaLimit = 4000; + float baseModifier = RuleR(Character, ModernAAScalingStartPercent); + int aaMinimum = RuleI(Character, ModernAAScalingAAMinimum); + int aaLimit = RuleI(Character, ModernAAScalingAALimit); // Calculate the current total before checking if we will add additional xp. uint32 totalWithoutExpMod = (uint32)add_aaxp * aatotalmod; @@ -77,7 +76,10 @@ static uint32 ScaleAAXPBasedOnCurrentAATotal(int earnedAA, uint32 add_aaxp, floa return totalWithoutExpMod; } - Log(Logs::Detail, Logs::None, "Total before the modifier %d :: NewTotal %d :: ScaleRange: %d, SpentAA: %d, RemainingAA: %d, normalizedScale: %0.3f", totalWithoutExpMod, totalWithExpMod, scaleRange, earnedAA, remainingAA, normalizedScale); + Log(Logs::Detail, + Logs::None, + "Total before the modifier %d :: NewTotal %d :: ScaleRange: %d, SpentAA: %d, RemainingAA: %d, normalizedScale: %0.3f", + totalWithoutExpMod, totalWithExpMod, scaleRange, earnedAA, remainingAA, normalizedScale); return totalWithExpMod; } @@ -404,7 +406,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { uint32 aaexp = 0; // if using modernAA and this character has AA XP enabled. - if (true && add_aaxp > 0) + if (RuleB(Character, UseModernAAExperienceScale) && add_aaxp > 0) { aaexp = ScaleAAXPBasedOnCurrentAATotal(GetAAPoints(), add_aaxp, aatotalmod); }