RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RevShortcutAction.java
1package com.osroyale.game.action.impl;
2
3import com.osroyale.Config;
4import com.osroyale.game.action.Action;
5import com.osroyale.game.action.policy.WalkablePolicy;
6import com.osroyale.game.world.entity.mob.Direction;
7import com.osroyale.game.world.entity.mob.player.Player;
8import com.osroyale.game.world.entity.skill.Skill;
9import com.osroyale.game.world.position.Position;
10
11public class RevShortcutAction extends Action<Player> {
12
13 int tick, xp, x, y;
14 Direction direction;
15 public RevShortcutAction(Player player, Direction direction, int xp) {
16 super(player, 1);
17 this.direction = direction;
18 this.xp = xp;
19
20 if(direction == Direction.SOUTH) {
21 x = 0;
22 y = -2;
23 } else if(direction == Direction.NORTH) {
24 x = 0;
25 y = 2;
26 } else if(direction == Direction.EAST) {
27 x = 2;
28 y = 0;
29 } else if(direction == Direction.WEST) {
30 x = -2;
31 y = 0;
32 }
33 }
34
35 @Override
36 public WalkablePolicy getWalkablePolicy() {
37 return WalkablePolicy.NON_WALKABLE;
38 }
39
40 @Override
41 public String getName() {
42 return "Rev shortcut";
43 }
44
45 @Override
46 protected void execute() {
47 final Player p = getMob();
48 if(tick == 0 || tick == 2) {
49 p.forceMove(1, 741, 0, 30, new Position(x, y), direction);
50 } else if(tick == 1 || tick == 3) {
51 p.move(new Position((p.getPosition().getX() + x), (p.getPosition().getY() + y)));
52 }
53 if(tick == 3) {
54 p.skills.addExperience(Skill.AGILITY, xp * Config.AGILITY_MODIFICATION);
55 cancel();
56 }
57
58 tick++;
59 }
60
61 @Override
62 public boolean cancellableInProgress() {
63 return false;
64 }
65
66}
abstract WalkablePolicy getWalkablePolicy()
synchronized final void cancel()
Definition Task.java:147