Shantay quick-pass now functions authentically

This commit is contained in:
Zerken 2023-07-17 08:59:35 +00:00 committed by Ryan
parent 6de25bd7e1
commit 942fd2876e
2 changed files with 18 additions and 4 deletions

View file

@ -1,10 +1,12 @@
package content.region.desert.handlers;
import core.api.Container;
import core.cache.def.impl.NPCDefinition;
import core.cache.def.impl.SceneryDefinition;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.dialogue.FacialExpression;
import core.game.global.action.DoorActionHandler;
import content.global.skill.agility.AgilityHandler;
import core.game.interaction.OptionHandler;
@ -16,6 +18,10 @@ import core.game.node.scenery.Scenery;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Items;
import static core.api.ContentAPIKt.*;
import static core.tools.TickUtilsKt.ticksToCycles;
/**
* Represents the plugin to handle the shantay pass.
@ -84,11 +90,15 @@ public class ShantayPassPlugin extends OptionHandler {
player.getInterfaceManager().open(new Component(565));
break;
case "quick-pass":
if (player.getLocation().getY() < 3117) {
AgilityHandler.walk(player, 0, player.getLocation(), player.getLocation().transform(0, player.getLocation().getY() > 3116 ? -2 : 2, 0), null, 0, null);
return true;
if (player.getLocation().getY() > 3116) {
if (!inInventory(player, Items.SHANTAY_PASS_1854, 1)) {
sendNPCDialogue(player, 838, "You need a Shantay pass to get through this gate. See Shantay, he will sell you one for a very reasonable price.", FacialExpression.NEUTRAL);
return true;
}
if (!removeItem(player, Items.SHANTAY_PASS_1854, Container.INVENTORY)) return true;
sendMessage(player, "You hand your Shantay pass to the guard and pass through the gate.");
}
player.getDialogueInterpreter().open(838, 838, true);
forceMove(player, player.getLocation(), player.getLocation().transform(0, player.getLocation().getY() > 3116 ? -2 : 2, 0), 0, ticksToCycles(2), null, 819, null);
break;
}
return true;

View file

@ -19,6 +19,10 @@ fun cyclesToTicks (cycles: Int) : Int {
return kotlin.math.ceil (cycles / cyclesPerTick.toDouble()).toInt()
}
fun ticksToCycles (ticks: Int) : Int {
return ticks * (tick / cycle)
}
fun minutesToTicks(minutes: Int): Int {
val minutesMs = minutes * 60 * 1000
return minutesMs / tick