Add rule Character:FinalExpMultiplier - Added on top of everything else, easy for setting EXP events

This commit is contained in:
Akkadius 2020-08-21 01:04:18 -05:00
parent 482816058f
commit 32407dbb56
2 changed files with 38 additions and 23 deletions

View File

@ -52,6 +52,7 @@ RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse beh
RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items")
RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once")
RULE_REAL(Character, DragCorpseDistance, 400, "If a player is using /corpsedrag and moving, the corpse will not move until the player exceeds this distance")
RULE_REAL(Character, FinalExpMultiplier, 1, "Added on top of everything else, easy for setting EXP events")
RULE_REAL(Character, ExpMultiplier, 0.5, "If greater than 0, the experience gained is multiplied by this value. ")
RULE_REAL(Character, AAExpMultiplier, 0.5, "If greater than 0, the AA experience gained is multiplied by this value. ")
RULE_REAL(Character, GroupExpMultiplier, 0.5, "The experience in a group is multiplied by this value in addition to the group multiplier. The group multiplier is: 2 members=x 1.2, 3=x1.4, 4=x1.6, 5=x1.8, 6=x2.16")

View File

@ -194,6 +194,10 @@ uint32 Client::CalcEXP(uint8 conlevel) {
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
in_add_exp *= RuleR(Character, FinalExpMultiplier);
}
return in_add_exp;
}
@ -311,6 +315,10 @@ void Client::CalculateStandardAAExp(uint32 &add_aaxp, uint8 conlevel, bool resex
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
add_aaxp *= RuleR(Character, FinalExpMultiplier);
}
add_aaxp = (uint32)(RuleR(Character, AAExpMultiplier) * add_aaxp * aatotalmod);
}
@ -466,6 +474,10 @@ void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
add_exp *= RuleR(Character, FinalExpMultiplier);
}
add_exp = GetEXP() + add_exp;
}
@ -961,14 +973,16 @@ void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore
xp_for_level = GetEXPForLevel(max_level + 1) - GetEXPForLevel(max_level);
award = xp_for_level * exp_percentage / 100;
if(RuleB(Zone, LevelBasedEXPMods) && !ignore_mods)
{
if(zone->level_exp_mod[GetLevel()].ExpMod)
{
if (RuleB(Zone, LevelBasedEXPMods) && !ignore_mods) {
if (zone->level_exp_mod[GetLevel()].ExpMod) {
award *= zone->level_exp_mod[GetLevel()].ExpMod;
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
award *= RuleR(Character, FinalExpMultiplier);
}
uint32 newexp = GetEXP() + award;
SetEXP(newexp, GetAAXP());
}