Fixed ironman mode being stuck after permadeath
This commit is contained in:
@@ -4,6 +4,7 @@ import core.api.*
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.VarpManager
|
||||
import core.game.node.entity.player.info.login.PlayerSaver
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.game.node.entity.player.link.SavedData
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.player.link.quest.QuestRepository
|
||||
@@ -42,6 +43,7 @@ fun permadeath(target: Player) {
|
||||
}
|
||||
}
|
||||
target.musicPlayer.clearUnlocked()
|
||||
target.ironmanManager.mode = IronmanMode.NONE
|
||||
PlayerSaver(target).save()
|
||||
target.clear()
|
||||
}
|
||||
|
||||
@@ -622,17 +622,12 @@ public class Player extends Entity {
|
||||
packetDispatch.sendTempMusic(90);
|
||||
if (!getZoneMonitor().handleDeath(killer) && (!getProperties().isSafeZone() && getZoneMonitor().getType() != ZoneType.SAFE.getId()) && getDetails().getRights() != Rights.ADMINISTRATOR) {
|
||||
//If player was a Hardcore Ironman, announce that they died
|
||||
if (this.getIronmanManager().getMode().equals(IronmanMode.HARDCORE)){ //if this was checkRestriction, ultimate irons would be moved to HARDCORE_DEAD as well
|
||||
if (this.getIronmanManager().getMode().equals(IronmanMode.HARDCORE)) { //if this was checkRestriction, ultimate irons would be moved to HARDCORE_DEAD as well
|
||||
String gender = this.isMale() ? "man " : "woman ";
|
||||
if (getAttributes().containsKey("permadeath")) {
|
||||
Repository.sendNews("Permadeath Hardcore Iron" + gender + " " + this.getUsername() + " has fallen. Total Level: " + this.getSkills().getTotalLevel()); // Not enough room for XP
|
||||
permadeath(this);
|
||||
return;
|
||||
} else {
|
||||
Repository.sendNews("Hardcore Iron " + gender + " " + this.getUsername() + " has fallen. Total Level: " + this.getSkills().getTotalLevel()); // Not enough room for XP
|
||||
this.getIronmanManager().setMode(IronmanMode.STANDARD);
|
||||
asPlayer().getSavedData().getActivityData().setHardcoreDeath(true);
|
||||
this.sendMessage("You have fallen as a Hardcore Iron Man, your Hardcore status has been revoked.");
|
||||
}
|
||||
}
|
||||
GroundItemManager.create(new Item(526), getLocation(), k);
|
||||
|
||||
@@ -355,13 +355,13 @@ class PlayerSaveParser(val player: Player) {
|
||||
val skillData = saveFile!!["skills"] as JSONArray
|
||||
player.skills.parse(skillData)
|
||||
player.skills.experienceGained = saveFile!!["totalEXP"].toString().toDouble()
|
||||
player.skills.experienceMutiplier = saveFile!!["exp_multiplier"].toString().toDouble()
|
||||
player.skills.experienceMultiplier = saveFile!!["exp_multiplier"].toString().toDouble()
|
||||
if (GameWorld.settings?.default_xp_rate != 5.0) {
|
||||
player.skills.experienceMutiplier = GameWorld.settings?.default_xp_rate!!
|
||||
player.skills.experienceMultiplier = GameWorld.settings?.default_xp_rate!!
|
||||
}
|
||||
val divisor: Double
|
||||
if(player.skills.experienceMutiplier >= 10 && !player.attributes.containsKey("permadeath")){ //exclude permadeath HCIMs from XP squish
|
||||
divisor = player.skills.experienceMutiplier / 5.0
|
||||
if(player.skills.experienceMultiplier >= 10 && !player.attributes.containsKey("permadeath")){ //exclude permadeath HCIMs from XP squish
|
||||
divisor = player.skills.experienceMultiplier / 5.0
|
||||
player.skills.correct(divisor)
|
||||
}
|
||||
if (saveFile!!.containsKey("milestone")) {
|
||||
|
||||
@@ -569,7 +569,7 @@ class PlayerSaver (val player: Player){
|
||||
}
|
||||
root.put("skills",skills)
|
||||
root.put("totalEXP",player.skills.experienceGained.toString())
|
||||
root.put("exp_multiplier",player.skills.experienceMutiplier.toString())
|
||||
root.put("exp_multiplier",player.skills.experienceMultiplier.toString())
|
||||
if(player.skills.combatMilestone > 0 || player.skills.skillMilestone > 0){
|
||||
val milestone = JSONObject()
|
||||
milestone.put("combatMilestone",player.skills.combatMilestone.toString())
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class Skills {
|
||||
/**
|
||||
* Represents the constant modifier of experience.
|
||||
*/
|
||||
public double experienceMutiplier = 5.0;
|
||||
public double experienceMultiplier = 5.0;
|
||||
|
||||
/**
|
||||
* The maximum experience multiplier.
|
||||
@@ -289,7 +289,7 @@ public final class Skills {
|
||||
private double getExperienceMod(int slot, double experience, boolean playerMod, boolean multiplyer) {
|
||||
//Keywords for people ctrl + Fing the project
|
||||
//xprate xp rate xp multiplier skilling rate
|
||||
return experienceMutiplier;
|
||||
return experienceMultiplier;
|
||||
/*if (!(entity instanceof Player)) {
|
||||
return 1.0;
|
||||
}
|
||||
@@ -414,14 +414,14 @@ public final class Skills {
|
||||
setLifepoints(staticLevels[i]);
|
||||
}
|
||||
}
|
||||
experienceMutiplier = 5.0;
|
||||
experienceMultiplier = 5.0;
|
||||
updateCombatLevel();
|
||||
}
|
||||
|
||||
public void parseExpRate(ByteBuffer buffer) {
|
||||
experienceMutiplier = buffer.getDouble();
|
||||
if(GameWorld.getSettings().getDefault_xp_rate() != experienceMutiplier){
|
||||
experienceMutiplier = GameWorld.getSettings().getDefault_xp_rate();
|
||||
experienceMultiplier = buffer.getDouble();
|
||||
if(GameWorld.getSettings().getDefault_xp_rate() != experienceMultiplier){
|
||||
experienceMultiplier = GameWorld.getSettings().getDefault_xp_rate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public final class Skills {
|
||||
}
|
||||
|
||||
public void saveExpRate(ByteBuffer buffer) {
|
||||
buffer.putDouble(experienceMutiplier);
|
||||
buffer.putDouble(experienceMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user