Fixed issue preventing some dragonstone jewellery teleports working at level 30 wilderness

This commit is contained in:
Player Name 2024-01-29 09:48:28 +00:00 committed by Ryan
parent 9a5f1e85e2
commit 2255238554
2 changed files with 38 additions and 7 deletions

View file

@ -13,6 +13,9 @@ import core.game.world.map.Location;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.rs09.consts.Items;
/**
* Handles the zones for an entity.
@ -20,6 +23,35 @@ import java.util.List;
*/
public final class ZoneMonitor {
/**
* The set of dragonstone teleport jewellery, which allow teleporting from up to and including level 30 wildy.
* Used to check if a player can teleport from 20 < level <= 30 wildy, see canTeleportByDragonstoneJewellery.
* Note: the check is based on the nextJewellery (see EnchantedJewellery.kt), so this list should not contain the (4) items, and should contain the empty ones.
* @author Player Name
*/
static final Set<Integer> DRAGONSTONE_TELEPORT_JEWELLERY = Set.of(
Items.AMULET_OF_GLORY_1704,
Items.AMULET_OF_GLORY1_1706,
Items.AMULET_OF_GLORY2_1708,
Items.AMULET_OF_GLORY3_1710,
Items.AMULET_OF_GLORYT_10362,
Items.AMULET_OF_GLORYT1_10360,
Items.AMULET_OF_GLORYT2_10358,
Items.AMULET_OF_GLORYT3_10356,
Items.SKILLS_NECKLACE_11113,
Items.SKILLS_NECKLACE1_11111,
Items.SKILLS_NECKLACE2_11109,
Items.SKILLS_NECKLACE3_11107,
Items.COMBAT_BRACELET_11126,
Items.COMBAT_BRACELET1_11124,
Items.COMBAT_BRACELET2_11122,
Items.COMBAT_BRACELET3_11120,
Items.RING_OF_WEALTH_14638,
Items.RING_OF_WEALTH1_14640,
Items.RING_OF_WEALTH2_14642,
Items.RING_OF_WEALTH3_14644
);
/**
* The entity.
*/
@ -203,7 +235,7 @@ public final class ZoneMonitor {
* @return {@code True} if so.
*/
public boolean teleport(int type, Node node) {
if (type != -1 && entity.isTeleBlocked() && !canTeleportByGlory(type, node)) {
if (type != -1 && entity.isTeleBlocked() && !canTeleportByDragonstoneJewellery(type, node)) {
if (entity.isPlayer()) {
entity.asPlayer().sendMessage("A magical force has stopped you from teleporting.");
}
@ -218,14 +250,13 @@ public final class ZoneMonitor {
}
/**
* Checks if a player can teleport with a glory in >= 1 <= 30 wilderness level
* Checks if a player can teleport with a dragonstone jewellery piece in >= 1 <= 30 wilderness level
* @return {@code True} if so.
*/
private boolean canTeleportByGlory(int type, Node node) {
if (type != 1 || !node.asItem().getName().contains("Amulet of glory")) {
private boolean canTeleportByDragonstoneJewellery(int type, Node node) {
if (type != 1 || !DRAGONSTONE_TELEPORT_JEWELLERY.contains(node.asItem().getId())) {
return false;
}
if (entity.timers.getTimer("teleblock") != null)
return false;

View file

@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test
class ZoneMonitorTests {
val GLORIES = intArrayOf(1710, 1708, 1706, 1712)
val GLORIES = intArrayOf(1710, 1708, 1706, 1704)
init {
TestUtils.preTestSetup()