Hey
I followed this tutorial https://www.rune-server.ee/runescape...ml#post5496377
I manged to fix that error when you wear something, and log out then it sets all stats to 0
Now I'm having issue when an player dies it will double your stats
Example: I'm @ fight pits, I died to mobs which means I failed minigame and I didn't lose anything so I kept all my items on etc, then it doubles my stats. After I relog stats will be fine once again depends what you wear.
If an staff dies to wilderness (He wont lose anything) and also keeps his items on when he dies, stats will double.
That's the issue I'm having right now
Death methods
OSR Base
Code:
/** The main part of the death process where the killer is found for the character. */
@Override
public void death() {
Mob killer = mob.getCombat().getDamageCache().calculateProperKiller().orElse(null);
if (mob.inActivity() && Activity.evaluate(mob, Activity::safe)) {
safe = true;
return;
}
if (Area.inZulrah(mob)) {
safe = true;
return;
}
if (Area.inEventArena(mob)) {
safe = true;
return;
}
if (!PlayerRight.isPriviledged(mob)) {
Pets.onDeath(mob);
calculateDropItems(mob, killer);
}
if (killer == null)
return;
switch (killer.getType()) {
case PLAYER:
Player playerKiller = killer.getPlayer();
if (mob.isBot) {
playerKiller.pkPoints += 1;
playerKiller.message("<col=295EFF>You were rewarded with 1 point for that bot kill. You now have: " + Utility.formatDigits(playerKiller.pkPoints) + ".");
return;
}
if (!PlayerKilling.contains(playerKiller, mob.lastHost)) {
AchievementHandler.activate(playerKiller, AchievementKey.KILLER, 1);
playerKiller.send(new SendMessage(Utility.randomElement(DEATH_MESSAGES).replace("$VICTIM", mob.getName())));
PlayerKilling.handle(playerKiller, mob);
} else {
playerKiller.message("<col=FF0019>You have recently killed " + mob.getName() + " and therefore were not rewarded. You must kill ", "<col=FF0019>3 new players to reset this!");
}
EventDispatcher.execute(playerKiller, new OnKillEvent(mob));
break;
case NPC:
break;
default:
break;
}
}
/** The last part of the death process where the character is reset. */
@Override
public void postDeath(Mob killer) {
if (mob.isBot) {
((PlayerBot) mob).postDeath();
return;
}
mob.runEnergy = 100;
mob.skulling.unskull();
mob.skills.restoreAll();
mob.inventory.refresh();
mob.equipment.login();
mob.action.reset();
mob.playerAssistant.reset();
mob.interfaceManager.close();
mob.setSpecialActivated(false);
mob.getCombat().getDamageCache().clear();
mob.send(new SendRunEnergy());
CombatSpecial.restore(mob, 100);
mob.movement.reset();
mob.teleblockTimer.set(0);
if (mob.inActivity()) {
Activity.forActivity(mob, it -> it.onDeath(mob));
return;
}
mob.move(Config.DEFAULT_POSITION);
mob.send(new SendMessage("Oh dear, you are dead!"));
if (mob.presetManager.deathOpen) {
World.schedule(1, mob.presetManager::open);
}
if (!safe) {
if (killer != null && killer.isPlayer() && !mob.equals(killer)) {
mob.killstreak.end(killer.getName());
}
if (mob.right == PlayerRight.HARDCORE_IRONMAN) {
mob.right = PlayerRight.IRONMAN;
mob.updateFlags.add(UpdateFlag.APPEARANCE);
mob.send(new SendMessage("You have lost your hardcore iron man status since you died! Sucks to suck."));
World.sendMessage("<icon=1> <col=FF0000>OSR: <col=" + mob.right.getColor() + ">" + mob.getName() + "</col>'s hardcore iron man account was lost!");
}
}
InterfaceWriter.write(new InformationWriter(mob));
}
SOLVED!