diff --git a/common/ruletypes.h b/common/ruletypes.h index 4d90bd6f8..6edc5518d 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -44,6 +44,7 @@ RULE_INT(Character, DeathExpLossLevel, 10, "Any level equal to or greater than t RULE_INT(Character, DeathExpLossMaxLevel, 255, "Every higher level will no longer lose experience at death") RULE_INT(Character, DeathItemLossLevel, 10, "From this level on, items are left in the corpse when LeaveCorpses is activated") RULE_INT(Character, DeathExpLossMultiplier, 3, "Adjust how much experience is lost. Default 3.5% (0=0.5%, 1=1.5%, 2=2.5%, 3=3.5%, 4=4.5%, 5=5.5%, 6=6.5%, 7=7.5%, 8=8.5%, 9=9.5%, 10=11%)") +RULE_BOOL(Character, DeathKeepLevel, false, "Players can not drop below 0% experience from death.") RULE_BOOL(Character, UseDeathExpLossMult, false, "Setting to control whether DeathExpLossMultiplier or the code default is used: (Level x Level / 18.0) x 12000") RULE_BOOL(Character, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore") RULE_INT(Character, CorpseDecayTimeMS, 10800000, "Time after which the corpse decays (milliseconds)") diff --git a/zone/attack.cpp b/zone/attack.cpp index 367e3a38e..1745e6fc9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1843,6 +1843,15 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill exploss *= zone->level_exp_mod[GetLevel()].ExpMod; } + if (exploss > 0 && RuleB(Character, DeathKeepLevel)) { + int32 total_exp = GetEXP(); + uint32 level_min_exp = GetEXPForLevel(killed_level); + int32 level_exp = total_exp - level_min_exp; + if (exploss > level_exp) { + exploss = level_exp; + } + } + if ((GetLevel() < RuleI(Character, DeathExpLossLevel)) || (GetLevel() > RuleI(Character, DeathExpLossMaxLevel)) || IsBecomeNPC()) { exploss = 0;