Potential fix for wilderness course stepping stone bug
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package core.game.node.entity.skill.agility;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.game.node.entity.player.link.TeleportManager;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.MovementPulse;
|
||||
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
|
||||
@@ -100,21 +102,26 @@ public final class AgilityHandler {
|
||||
*/
|
||||
public static void fail(final Player player, int delay, final Location dest, Animation anim, final int hit, final String message) {
|
||||
if (anim != null) {
|
||||
player.animate(anim);
|
||||
ContentAPI.animate(player, anim, true);
|
||||
}
|
||||
GameWorld.getPulser().submit(new Pulse(anim.getDefinition().getDurationTicks(), player) {
|
||||
ContentAPI.submitWorldPulse(new Pulse(ContentAPI.animationDuration(anim), player) {
|
||||
boolean dmg = false;
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.getProperties().setTeleportLocation(dest);
|
||||
player.animate(Animation.RESET);
|
||||
ContentAPI.teleport(player, dest, TeleportManager.TeleportType.INSTANT);
|
||||
ContentAPI.animate(player, Animation.RESET, true);
|
||||
if(!dmg) {
|
||||
if (hit > 0) {
|
||||
player.getImpactHandler().setDisabledTicks(0);
|
||||
player.getImpactHandler().manualHit(player, hit, HitsplatType.NORMAL);
|
||||
ContentAPI.impact(player, hit, HitsplatType.NORMAL);
|
||||
}
|
||||
if (message != null) {
|
||||
player.getPacketDispatch().sendMessage(message);
|
||||
ContentAPI.sendMessage(player, message);
|
||||
}
|
||||
return true;
|
||||
dmg = true;
|
||||
}
|
||||
setDelay(0);
|
||||
return player.getLocation().equals(dest);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -767,7 +767,8 @@ object ContentAPI {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType = TeleportManager.TeleportType.INSTANT){
|
||||
entity.teleporter.send(loc,type)
|
||||
if(type == TeleportManager.TeleportType.INSTANT) entity.properties.teleportLocation = loc
|
||||
else entity.teleporter.send(loc,type)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package rs09.game.node.entity.skill.agility
|
||||
|
||||
import api.ContentAPI
|
||||
import core.cache.def.impl.ObjectDefinition
|
||||
import core.game.content.global.action.DoorActionHandler
|
||||
import core.game.node.Node
|
||||
@@ -176,26 +177,26 @@ class WildernessCourse
|
||||
* @param object the object.
|
||||
*/
|
||||
private fun handleSteppingStones(player: Player, `object`: Scenery) {
|
||||
player.locks.lock()
|
||||
ContentAPI.lock(player, 50)
|
||||
val fail = AgilityHandler.hasFailed(player, 1, 0.3)
|
||||
player.addExtension(LogoutTask::class.java, LocationLogoutTask(12, player.location))
|
||||
GameWorld.Pulser.submit(object : Pulse(2, player) {
|
||||
val origLoc = player.location
|
||||
ContentAPI.registerLogoutListener(player, "steppingstone"){p ->
|
||||
ContentAPI.teleport(p, origLoc)
|
||||
}
|
||||
ContentAPI.submitWorldPulse(object : Pulse(2, player){
|
||||
var counter = 0
|
||||
override fun pulse(): Boolean {
|
||||
if (counter == 3 && fail) {
|
||||
AgilityHandler.fail(player, -1, Location.create(3001, 3963, 0), Animation.create(771), (player.skills.lifepoints * 0.26).toInt(), "...You lose your footing and fall into the lava.")
|
||||
return true
|
||||
}
|
||||
AgilityHandler.forceWalk(player, if (counter == 5) 2 else -1, player.location, player.location.transform(-1, 0, 0), Animation.create(741), 10, if (counter == 5) 20.0 else 0.toDouble(), if (counter != 0) null else "You carefully start crossing the stepping stones...")
|
||||
AgilityHandler.forceWalk(player, if (counter == 5) 2 else -1, player.location, player.location.transform(-1, 0, 0), Animation.create(741), 10, if (counter == 5) 20.0 else 0.0, if (counter != 0) null else "You carefully start crossing the stepping stones...")
|
||||
if(++counter == 6){
|
||||
player.unlock()
|
||||
ContentAPI.unlock(player)
|
||||
ContentAPI.clearLogoutListener(player, "steppingstone")
|
||||
}
|
||||
return counter == 6
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
super.stop()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user