[Guide][JAVA]How to remove revive timer in purgatory

Paulus

Administrator
Staff member
#1
This guide shows how to remove the timer that make player wait XXmin in puragtory before leaving. With this modification players can leave instantly purgatory and as the cost in Myrh to leave purgatory is based on waiting time, it's also automatically set to 0.

  • First we need to decompile gameMecahnics.world.avatar.DeathManager.class
  • Once we have decompiled the class, we can find a pretty explicit method called setSparkReturnDelay, this method set the time a player have to wait in purgatory.
Java:
    private void setSparkReturnDelay(int var1) {
        this.sparkReturnDelay = var1;
        this.getReplicatorsContainer().g();
    }
Here we can see two operations: the first one actually set the delay in server side that will be used to check if player can leave purgatory; the second one send the information to the client that can display the amount of time before the player can leave. As you can see the information is sent only once to the client that have a replicated class that will decrement the timer locally in order to optimize net code (but the server side will always be checked while leaving purgatory to avoid cheating).​

  • To make people leaving for free we actually want to override the sparkReturnDelay value. In first approach we would want to put something like this:
Java:
    private void setSparkReturnDelay(int var1) {
        this.sparkReturnDelay = 0;
        this.getReplicatorsContainer().g();
    }
It works but it will send you some errors to your server log as you coompletely override all incoming values and set it to 0 but default reseting value of death timer is -1 as we can see up:​
Java:
    @cb
    private int sparkReturnDelay = -1;
So overriding this value to 0 will send you this message while the system try to get to get back to default state:​
Code:
[10-25 03:25:40,302, 546423] gm2(132) - ERROR verify  : Avatar[132, 5512, 2][ONLINE]p(1519.8, 1518.8, 2.4)MapResource:/Maps/Hadagan_Sanatorium/MapResource.xdb[Paulus#4]: inconsistent death manager phase start for Died->Grave: deathTime = 1,540,430,736,036, respawnTime =$java.lang.Throwable
        at asserts.Verify.fail(Verify.java:42)
        at asserts.Verify.failf(Verify.java:10)
        at gameMechanics.world.avatar.DeathManager$g_.a(DeathManager.java:429)
        at gameMechanics.world.WorldAvatarRespawnStrategy.onRespawn(WorldAvatarRespawnStrategy.java:2)
        at gameMechanics.world.avatar.gc.a(gc.java:21)
        at gameMechanics.world.avatar.gc.a(gc.java:29)
        at gameMechanics.clientCommands.CmdRespawn.exec(CmdRespawn.java:3)
        at gameMechanics.world.avatar.wc.a(wc.java:21)
        at dataMining.c.b(c.java:14)
        at dataMining.h.run(h.java:11)
        at msgSystem.impl.msgPublisher.l.c(l.java:6)
        at msgSystem.impl.msgPublisher.l.access$200(l.java:33)
        at msgSystem.impl.msgPublisher.l$c_.a(l$c_.java:1)
        at msgSystem.impl.msgPublisher.l$c_.execute(l$c_.java:4)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.msgProcessor.d$c_.a(d$c_.java:12)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.msgProcessor.d$c_.execute(d$c_.java:3)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.msgProcessor.d$b_.a(d$b_.java:13)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.msgProcessor.d$b_.access$1400(d$b_.java:43)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.msgProcessor.d.a(d.java:21)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.e.a(e.java:22)
        at msgSystem.impl.msgPublisher.serversConnectionsMap.g.a(g.java:39)
        at msgSystem.impl.msgPublisher.l.tick(l.java:131)
        at system.base.tickables.b$c_.a(b$c_.java:1)
        at system.base.tickables.b$b_.tick(b$b_.java:6)
        at system.base.tickables.b.tick(b.java:8)
        at basement.server.e.e(e.java:51)
        at basement.server.e.run(e.java:26)
        at java.lang.Thread.run(Thread.java:722)
You can then override to -1 to get rid of the error (it should work but I haven't tried it). Personnaly I choose an other option in order to keep a different state (this is probably idiot as -1 value is also checked in condition to leave purgatory, I'll probably change it after). So you can put either:​
Java:
    private void setSparkReturnDelay(int var1) {
        this.sparkReturnDelay = -1;
        this.getReplicatorsContainer().g();
    }
Java:
    private void setSparkReturnDelay(int sparkReturnDelay) {
        this.sparkReturnDelay = sparkReturnDelay > 0 ? 0 : sparkReturnDelay;
        this.getReplicatorsContainer().g();
    }
  • Then recompile files with jdk 1.7 and override the .class files with the new ones in the corresponding jar file.