Fixed incorrect message when trying to use teleport levers while teleblocked

This commit is contained in:
Player Name 2023-08-20 03:40:36 +00:00 committed by Ryan
parent f8cdb5cff5
commit 7a585796be
4 changed files with 33 additions and 14 deletions

View file

@ -68,8 +68,12 @@ public final class WildernessLeverPlugin extends OptionHandler {
GameWorld.getPulser().submit(new Pulse(2, player) {
@Override
public boolean pulse() {
lever.message(player, index);
lever.teleport(player, lever.getLocation(index));
if (player.timers.getTimer("teleblock") == null) {
lever.message(player, index);
lever.teleport(player, lever.getLocation(index));
} else {
player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
}
return true;
}
});

View file

@ -17,6 +17,7 @@ import core.game.world.GameWorld
/**
* This class covers some listeners for the Lost City quest
* @author lila
* @author Player Name
*/
@Initializable
class LostCityListeners : InteractionListener {
@ -36,8 +37,12 @@ class LostCityListeners : InteractionListener {
override fun pulse(): Boolean {
when (count++) {
0 -> {
sendMessage(player,"The world starts to shimmer...")
teleport(player, Location(2452, 4473, 0), TeleportType.FAIRY_RING)
if (player.isTeleBlocked()) {
sendMessage(player,"A magical force has stopped you from teleporting.")
} else {
sendMessage(player,"The world starts to shimmer...")
teleport(player, Location(2452, 4473, 0), TeleportType.FAIRY_RING)
}
}
1 -> return isQuestComplete(player,quest)
2 -> {

View file

@ -19,8 +19,9 @@ import core.tools.RandomFunction;
/**
* Represents the wilderness obelisk plugin.
* @author 'Vexia, small changes by Player Name
* @version 1.1
* @author 'Vexia
* @author Player Name
* @version 1.2
*/
@Initializable
public final class WildernessObeliskPlugin extends OptionHandler {
@ -103,10 +104,14 @@ public final class WildernessObeliskPlugin extends OptionHandler {
Obelisk newObelisk = newObelisks[index];
// Teleport players standing within a 3-by-3 bounding box
for (Player player : RegionManager.getLocalPlayersBoundingBox(center, 1, 1)) {
player.getPacketDispatch().sendMessage("Ancient magic teleports you somewhere in the wilderness.");
int xOffset = player.getLocation().getX() - center.getX();
int yOffset = player.getLocation().getY() - center.getY();
player.getTeleporter().send(Location.create(newObelisk.getLocation().getX() + xOffset, newObelisk.getLocation().getY() + yOffset, 0), TeleportType.OBELISK, 2);
if (player.timers.getTimer("teleblock") == null) {
player.getPacketDispatch().sendMessage("Ancient magic teleports you somewhere in the wilderness.");
int xOffset = player.getLocation().getX() - center.getX();
int yOffset = player.getLocation().getY() - center.getY();
player.getTeleporter().send(Location.create(newObelisk.getLocation().getX() + xOffset, newObelisk.getLocation().getY() + yOffset, 0), TeleportType.OBELISK, 2);
} else {
player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
}
}
super.setDelay(1);
return false;

View file

@ -71,7 +71,8 @@ public final class WildernessPlugin extends OptionHandler {
* Represents the plugin used to handle kbd nodes.
*
* @author 'Vexia
* @version 1.0
* @author Player Name
* @version 1.1
*/
public static final class KBDPlugin extends OptionHandler {
@ -123,9 +124,13 @@ public final class WildernessPlugin extends OptionHandler {
if (player.getLocation().withinDistance(LOCATIONS[5])) {
animate(player, 2140, false);
playAudio(player, Sounds.LEVER_2400);
player.getPacketDispatch().sendMessage("You pull the lever...");
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL);
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5);
if (player.isTeleBlocked()) {
player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
} else {
player.getPacketDispatch().sendMessage("You pull the lever...");
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL);
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5);
}
}
break;
case 1817: