RuneHive-Game
Loading...
Searching...
No Matches
RevShortcutAction.java
Go to the documentation of this file.
1package com.runehive.game.action.impl;
2
3import com.runehive.Config;
4import com.runehive.game.action.Action;
5import com.runehive.game.action.policy.WalkablePolicy;
6import com.runehive.game.world.entity.mob.Direction;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.entity.skill.Skill;
9import com.runehive.game.world.position.Position;
10
11public class RevShortcutAction extends Action<Player> {
12
13 int tick, xp, x, y;
16 super(player, 1);
17 this.direction = direction;
18 this.xp = xp;
19
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
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) {
55 cancel();
56 }
57
58 tick++;
59 }
60
61 @Override
62 public boolean cancellableInProgress() {
63 return false;
64 }
65
66}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final double AGILITY_MODIFICATION
The experience modification for agility.
Definition Config.java:247
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
void execute()
A function representing the unit of work that will be carried out.
RevShortcutAction(Player player, Direction direction, int xp)
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
String getName()
Gets the name of this action.
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
void forceMove(int animation, int x, int y)
Definition Mob.java:255
void move(Position position)
Moves the mob to a set position.
Definition Mob.java:340
This class represents a character controlled by a player.
Definition Player.java:125
Represents a trainable and usable skill.
Definition Skill.java:18
static final int AGILITY
The agility skill id.
Definition Skill.java:69
void addExperience(int id, double experience)
Adds experience to a given skill.
Represents a single tile on the game world.
Definition Position.java:14
int getY()
Gets the absolute y coordinate.
Definition Position.java:46
int getX()
Gets the absolute x coordinate.
Definition Position.java:41
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.
Represents the enumerated directions an entity can walk or face.