1package com.osroyale.game.action.impl;
3import com.osroyale.content.skill.impl.magic.teleport.Teleportation;
4import com.osroyale.content.skill.impl.magic.teleport.TeleportationData;
5import com.osroyale.game.Animation;
6import com.osroyale.game.UpdatePriority;
7import com.osroyale.game.action.Action;
8import com.osroyale.game.action.policy.WalkablePolicy;
9import com.osroyale.game.world.entity.mob.Direction;
10import com.osroyale.game.world.entity.mob.player.Player;
11import com.osroyale.game.world.object.GameObject;
12import com.osroyale.game.world.position.Position;
13import com.osroyale.net.packet.out.SendMessage;
14import com.osroyale.util.MessageColor;
16import java.util.function.Predicate;
18public class LeverAction
extends Action<Player> {
20 private final GameObject lever;
21 private final Position position;
22 private final Direction face;
23 private final Predicate<Player> condition;
24 private final String message;
26 public LeverAction(Player mob, GameObject lever, Position position, Direction face) {
27 this(mob, lever, position, face,
null,
null);
30 private LeverAction(Player mob, GameObject lever, Position position, Direction face, Predicate<Player> condition, String message) {
33 this.position = position;
35 this.condition = condition;
36 this.message = message;
41 if (condition !=
null && !condition.test(
getMob())) {
42 getMob().send(
new SendMessage(message, MessageColor.RED));
52 getMob().getCombat().reset();
53 getMob().damageImmunity.reset(3_000);
59 getMob().send(
new SendMessage(
"You pull the lever..."));
60 getMob().animate(
new Animation(2140, UpdatePriority.VERY_HIGH));
61 }
else if (count == 1) {
62 Teleportation.activateOverride(
getMob(), position, TeleportationData.MODERN);
69 protected void onCancel(
boolean logout) {
80 return "Lever action";
abstract String getName()
abstract WalkablePolicy getWalkablePolicy()
synchronized final void cancel()