RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
PuroPuroAction.java
1package com.osroyale.content.skill.impl.hunter.net;
2
3import com.osroyale.game.action.Action;
4import com.osroyale.game.action.policy.WalkablePolicy;
5import com.osroyale.game.world.entity.mob.player.Player;
6import com.osroyale.game.world.object.GameObject;
7
8public class PuroPuroAction extends Action<Player> {
9 private final GameObject object;
10 private boolean run = false;
11 private int walkAnimation;
12
13 public PuroPuroAction(Player player, GameObject object) {
14 super(player, 3, false);
15 this.object = object;
16 }
17
18 @Override
19 protected void onSchedule() {
20 run = getMob().movement.isRunningToggled();
21 walkAnimation = getMob().mobAnimation.getWalk();
22 getMob().mobAnimation.setWalk(6594);
23
24 getMob().locking.lock();
25 getMob().movement.setRunningToggled(false);
26 getMob().message("You use your strength to push through the wheat.");
27
28 int dx = 0;
29 int dy = 0;
30
31 if (getMob().getX() > object.getX()) {
32 dx = -2;
33 } else if (getMob().getX() < object.getX()) {
34 dx = 2;
35 }
36
37 if (getMob().getY() > object.getY()) {
38 dy = -2;
39 } else if (getMob().getY() < object.getY()) {
40 dy = 2;
41 }
42
43 getMob().walk(getMob().getPosition().transform(dx, dy), true);
44 }
45
46 @Override
47 protected void execute() {
48 cancel();
49 }
50
51 @Override
52 protected void onCancel(boolean logout) {
53 getMob().locking.unlock();
54 getMob().mobAnimation.setWalk(walkAnimation);
55 getMob().movement.setRunningToggled(run);
56 }
57
58 @Override
59 public WalkablePolicy getWalkablePolicy() {
60 return WalkablePolicy.NON_WALKABLE;
61 }
62
63 @Override
64 public String getName() {
65 return "puro-puro-action";
66 }
67}
abstract WalkablePolicy getWalkablePolicy()
synchronized final void cancel()
Definition Task.java:147