From fdaa42edd3a256ae28688d4aea21754f1f4e59ce Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 21 Oct 2013 09:00:32 -0400 Subject: [PATCH] Fire appropriate level change events for Hardcore mode. --- .../java/com/gmail/nossr50/util/HardcoreManager.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java index cd54020d3..3ccd209bb 100644 --- a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java +++ b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java @@ -35,8 +35,11 @@ public final class HardcoreManager { totalLevelsLost += levelsLost; + float xpRemoved = playerProfile.getSkillXpLevelRaw(skillType); playerProfile.modifySkill(skillType, playerSkillLevel - levelsLost); playerProfile.removeXp(skillType, xpLost); + + EventUtils.handleLevelChangeEvent(player, skillType, levelsLost, xpLost + xpRemoved, false); } player.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PlayerDeath", totalLevelsLost)); @@ -69,11 +72,18 @@ public final class HardcoreManager { totalLevelsStolen += levelsStolen; + float killerXpRemoved = killerProfile.getSkillXpLevelRaw(skillType); killerProfile.modifySkill(skillType, killerSkillLevel + levelsStolen); - killerProfile.addXp(skillType, xpStolen); + EventUtils.handleLevelChangeEvent(killer, skillType, levelsStolen, killerXpRemoved, true); + killerProfile.addXp(skillType, xpStolen); + EventUtils.handleXpGainEvent(killer, skillType, xpStolen); + + float victimXpRemoved = killerProfile.getSkillXpLevelRaw(skillType); victimProfile.modifySkill(skillType, victimSkillLevel - levelsStolen); victimProfile.removeXp(skillType, xpStolen); + + EventUtils.handleLevelChangeEvent(victim, skillType, levelsStolen, victimXpRemoved + xpStolen, false); } if (totalLevelsStolen > 0) {