Skip to content

Commit c0a2a41

Browse files
committed
simplify experience code
1 parent ed89142 commit c0a2a41

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Intersect.Server.Core/Entities/Player.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,16 +1151,10 @@ public override void Die(bool dropItems = true, Entity killer = null)
11511151
{
11521152
if (Options.Instance.Player.ExpLossOnDeathPercent > 0)
11531153
{
1154-
if (Options.Instance.Player.ExpLossFromCurrentExp)
1155-
{
1156-
var ExpLoss = (this.Exp * (Options.Instance.Player.ExpLossOnDeathPercent / 100.0));
1157-
TakeExperience((long)ExpLoss);
1158-
}
1159-
else
1160-
{
1161-
var ExpLoss = (GetExperienceToNextLevel(this.Level) * (Options.Instance.Player.ExpLossOnDeathPercent / 100.0));
1162-
TakeExperience((long)ExpLoss);
1163-
}
1154+
var baseExp = Options.Instance.Player.ExpLossFromCurrentExp ? Exp : GetExperienceToNextLevel(Level);
1155+
var expRatioLost = Options.Instance.Player.ExpLossOnDeathPercent / 100.0;
1156+
var expLost = (long)(baseExp * expRatioLost);
1157+
TakeExperience(expLost);
11641158
}
11651159
}
11661160
PacketSender.SendEntityDie(this);

0 commit comments

Comments
 (0)